Xamarin IOS BackGgroundColor doesn't work? - ios

I have a problem with the header of a listview, as I understand it, unlike Android, on IOS by default I have the background color = White .. I would like to have it as transparent as on android in fact, but I can't set it up, I'll post the code:enter image description here
Thanks in advance.

You may refer to this Cell Background Color on iOS.
In your code, change
<ViewCell Height="25" x:Name="ViewCellWithe" >
to
ViewCell Height="25" x:Name="ViewCellWithe" ios:Cell.DefaultBackgroundColor="Transparent" >

Related

Xamarin iOS change the default icon color to white in Light Mode

How do I display the dark mode icon while in Light mode on an iOS device? I have been searching this issue for months now and every post seems to come to dead end or the solutions just don't work. Using Xamarin 17.3 & VS 2022 and and developing an app for both Android & iOS. We have the Shell's background color (<Setter Property="Shell.BackgroundColor" Value="141B4D") which is a dark blue. The default, black icons (battery, time & etc.) don't show well with this background (its a company color and can't change it.) Android seems to handle this on its own and I didn't have to make any changes & the light icons show on the dark background in both Light & Dark modes. But on iOS in light mode the black icons display but cannot be seen. In dark mode the light icons show just fine.
Awhile back I tried a suggestion to to tell it, in the shared app, to use the dark mode icons in light mode.
<Shell.Resources>
<ResourceDictionary>
<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor" Value="{AppThemeBinding Dark=Black, Light=#141B4D}" />
<Setter Property="Shell.ForegroundColor" Value="{AppThemeBinding Dark=White, Light=White}" />
But this doesn't work. So I really need some help in solving this. And if this is not the proper way to handle this a good alternative is welcomed.
Thanks
Based on your code, seems that you just want the text or icon in statusbar to be white if i understand correctly. So a simple way to achieve is to add the following code in AppDelegate:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
...
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
return base.FinishedLaunching(app, options);
}
Also, you have to add one key in info.plist
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
Note: in Property List Editor, it will show View controller-based status bar appearance
Then in dark blue background, you can also see white icon. The following picture is in light mode.
Hope it works for you.

Storyboard is not showing custom color hex code in XCode 12.0.1

After updating to the latest Xcode, into storyboard I am not able to see actual custom color hex code. It is showing a white(FFFFFF) color hex code all time.
Can someone please help me with this? Please check the below screenshot.
I have noticed this same problem since the latest XCode Version 12.0.1.
A workaround that works for me is to
Click on the custom color to bring up the color chooser.
The color chooser is the wrong color, but tap on any other color in the color chooser.
Tap Cmd+Z to undo the color change. Magically the original custom color is now selected in the color chooser.
Almost the same idea work around and quicker without needing to change the color (and then reverse):
Select your color (this will make the color picker appear) in the drop list.
Select again your color (with the picker still shown) in the drop list (not in the color picker window), it will update the picker to your color.
Apple has now fixed this issue in Xcode 12.5
Fixed an issue where the custom colors swatch in an inspector’s color
properties displayed an incorrectly offset focus indicator.
Reference: Apple Xcode 12.5 Release Notes

How to change the root view background in a managed expo app?

With the introduction of Page Sheets in iOS 13, there is a white background in my app that I cannot seem to be able to change (behind the white Page Sheet, and the grey top of the underlying page):
Obviously, for most apps a black background color would look much better.
While for ejected React Native apps, one could use:
https://github.com/johniak/react-native-root-view-background
I'm curious if anyone using managed Expo has figured out a way to deal with this. As I cannot find much complaints about this issue, other than:
https://github.com/expo/expo/issues/1563
There is an simple trick using navigator...
<NavigationContainer>
<Stack.Navigator
screenOptions={{
cardStyle: {
backgroundColor: 'Your_Color_Here'
}
}}
<Stack.Screen name="Login" component={LoginScreen} />
<Stack.Screen name="Register" component={RegisterScreen} />
</Stack.Navigator>
</NavigationContainer >
You can use cardStyle to change default white backgroundColor to your desire backgroundColor. I hope this answer helps use it works for me.
For anyone out there who's using #react-navigation and looking for a way to change the background color of the root view between tab changes: simply add backgroundColor prop to app.json:
"backgroundColor": "#000000",
Might work in other scenarios as well.
I guess you are using react-navigation 5.x with createNativeStackNavigator and then using presentation:"modal" in your screen options. I could not find a way to set a black background the on the root view with this type of navigator.
Here's what I ended up doing :
create a standard StackNavigator with createStackNavigator, with mode='modal' property.
put all my modals within this navigator at the root of my app with ...TransitionPresets.ModalPresentationIOS in my screen options. This mimics the behavior you are looking for, as createStackNavigator respects the backgroundColor property set in your app.json file for it's root view.
I came up with this solution after finding this Snack (https://snack.expo.io/#satya164/modal-presentation-style-in-react-navigation). This is far from perfect but the best I could do for now using managed Expo. With nesting navigators, I keep using createNativeStackNavigator for push navigators to get nice, native push transitions for anything other than modals.

How to change the background colour of ListView on ios

I'm trying to change the backgorund colour of a ListView item on ios.
for Android i have this in my index.tss and it works fine :
'#ListView': {
top:'0%',
left:'0%',
height:'100%',
width:'98%',
zIndex:1,
backgroundImage: "/main.png",
backgroundColor:'#2e2f30',
borderColor:'transparent',
borderWidth:0,
borderRadius:0,
separatorColor:'#2d2f2f',
opacity:1
Im using an ImageView inside each item to basically just create and display a scrollable image list.
On Android, each row displays the image perfectly full without the white border around the image like on ios.
I want to remove the white colour background around the image on each row.
Titanium SDK 8.0
Regards
Sorry for the late answer.
I have set the item to transparent, thanks Mr. mukesh.kumar .
Regards

Change iOS System Keyboard Background Image and Buttons Image

Rather than creating a custom keyboard...how can I change the ios keyboard background image and get reference of the keyboard button or just the keyboard view programatically?
I do not want to replicate the whole ios keyboard, just tweak the keyboard here and there.
Solution Update:
You cannot update only the background or the buttons of the iOS System Keyboard! This is dues to the reason that Apple has limited the access to the Keyboard API. The most you can do is change the keyboard background color i.e. dark or light.
If you need to change the background to an image like me, you need to extend the ios keyboard i.e. make your own custom keyboard!
Please check below for accepted answer!
Hope this helps!
You can do something like this,
myTextField.keyboardType = UIKeyboardTypeDecimalPad; // many other options
myTextField.keyboardAppearance = UIKeyboardAppearanceDark; //many other options
If you want totally customize keyboard then refer this tutorial.
Hope this will help :)
For dark background you can use
mytextfield.keyboardAppearance = UIKeyboardAppearanceAlert;
For more customisation follow this link:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html

Resources