UISegmentedControl images always black on iOS 13 - ios

I'm using a UISegmentedControl with images. I'm trying to use template images and tintColor, selectedSegmentTintColor and backgroundColor all have different colors so all should be visible but images are always black. Sample of this is here: http://github.com/tomspee/SegmentedControl13.
Is there any way to fix black images on UISegmentedControl?
This is what I now get on iOS 13:
This is what I had in iOS 12 and would like to get on iOS 13 as well:
To add: I've already implemented the next code to opt-out of dark mode:
<key>UIUserInterfaceStyle</key>
<string>Light</string>

go to Image Set in the assets folder and setting the images to “Original Image” under the Render As option.

See there are two reasons to show always black in iOS 13. With iOS 13 we have a black theme also. if you want to restrict the black theme. You can use the below code.
<key>UIUserInterfaceStyle</key>
<string>Light</string>

Related

how to change toolbar icon color in Xamarin.Forms ios

It works for Android but in ios the toolbar icon is coming in a monochrome color. How to show them in the original icon image color ? Also I need to change the icon color dynamically based in the core source in xamarin.
Thanks for your help in advance.
You need to create entry in the Assets catalog and set RenderAs to 'Original'.

iOS 13 DarkMode and LaunchScreen - Fallback for iOS 10

I have a blue logo on the launchscreen.storyboard on white background.
For the new DarkMode introduced with iOS 13 I like to invert the colors, i.e. blue background and white logo.
As we know this can be done using named colors from the asset catalogues, which change depending on the traits of the device.
This is working totally fine in iOS 11 and up but shows this error when trying to support iOS 10:
Named colors do not work prior to iOS 11.0.
I tried making a view controller for the launchscreen scene in code and set the colors there using the #ifavailable clause, but the compiler says a launchscreen may not have a custom class associated with it.
I also thought of using different launchscreen storyboards depending on the iOS version but I couldn't find anything about how to.
Anything I can do about it?
How to solve this problem?
Thanks,
Felix
As suggested here, the solution is to use a dynamic image for the background instead:
Create 2 images with the flat colors for light and dark mode.
Import them in your Asset Catalog and define the “Any”/“Dark” appearances.
Add a UIImageView in the background of your Launch Screen with this image (“Scale to Fill”, constrained to container).
This will compile even if your deployment target is lower than iOS 11.0, and will display the appropriate color at launch.

Launch Images for Dark or Light Mode

How can I choose a different set of Launch images for Dark mode and for Light mode?
I have a LaunchImages set. When the application starts, an image is shown. For Light mode it seems good, however if I try to open my application on a device set to Dark mode (iOS 13), this image seems bad.
During the start application I can not use any code for dynamic changes and I have no options in XCode interface for managing it.
As the Launch Screen loads before the app starts executing, it would not be possible to change the launch images set programmatically.
However, in the Image Set tab, you can change the Appearance option to enable a different set of images for Light and Dark modes:
So, if you set this image in the Launch Screen Storyboard, the result would be as below:
On a side note, if the need is just to change the background color, not the images, you may set the Launch Screen Storyboard view background color to System Background Color and just use transparent PNG images.
Xcode 11 supports only storyboard Launch screen files. It means I
should use storyboards.
In storyboards we can use UIImageViews + images from .xcassets.
Assets support images with different variants: Light, Dark modes. You can apply constraints for positioning them on screen.
If you support iOS before 11.0 you can not use system dynamic colors for backgrounds of the screen view. In this case you put additional dynamic image to screen as background and apply leading, trailing, top and bottom constraints with negative values. Negative values are needed for covering Top and Bottom Bars. (I used -64px)
You need to add dark appearance for your asset, or for the asset color you are using, like in the image below:
You should do something like this to use light and dark mode images
Step 1 - Create image set in assets.xassets like this
Step 2 - Select Image select like this
Steps 3 - Change appearance to Any, Light , Dark like this
Add your images for any light and dark mode like this and use this image wherever you need it
Just for my experience, sometimes Launch image is changed when you erase your app, turn off your device and turn on again.

Dark mode launch screen in iOS 13

I've updated my iOS app to work in dark mode on iOS 13 but I am having trouble trying to get the launch screen to look good.
Currently it is a bright white screen with the app logo which looks awful in dark mode. I have tried setting the background colour of the launch screen to be a colour asset that I made with "Any Appearance" being white and "Dark Appearance" being black - but the launch screen still always shows as white.
Is there any way to get my launch screen to work properly in dark mode?
When setting up the Launch Screen storyboard, set the view "Background" color to "System Background Color". This will be white in light mode and black in dark mode. No need to use your own color asset.
I found a solution that supports earlier iOS versions as well as custom colors for each mode, dark and light, in iOS 13.
Create an image asset, set Appearances to Any, Light, Dark, and load small solid pngs with your desired colors. In this case I am using orange for light, and black for dark.
Go to your LanuchScreen.storyboard and add an image view with that image asset. Place the image behind your image logo, set Content Mode as Aspect Fill, and constrain the view to the Superview in all sides. (Make sure that your logo looks good with the two backgrounds, or set its Appearance too)
This is where I had to do a trick. For some reason, I couldn't make the back image to show up. After checking some of the comments in Launch Screen storyboard not displaying image, I added the first image in the image asset to the target bundle
The color is static in older versions of iOS, and it works well with dark and light modes in iOS 13.
I was updating my app to support new Dark Mode for iOS 13, I put "System Background Color" for the View's background in my LanuchScreen.storyboard, but surprisingly it didn't work!
The Logo image on the page was changing correctly based on Light/Dark Mode, but not the background!
I was about to apply Jose's solution, but before that, I decided to completely remove the app from my device and try again. And it worked!!
I was missing colors from my color palette in Xcode defaulty offered colors so I created my own using Color.xcassets where I created custom color set with appearences Any, Dark and set my colors.
Then I can use them in autolayout same like System Colors even in LaunchScreen
Yes Launch Screen work in dark mode, First check the background colour of your "xyz" image. if it is ok. just delete you app from device or simulator, because some time Launch Screen cached by device or simulator and you will not get the update UI on it. if you will face same problem just follow my demo app github.com/Indolia/darkmode.git

More Tab icons colour in iOS 8 and later

Background:
I am working on an application with multiple tabs, so there is a more tab on the right.
Issue:
In iOS 7, the colour of icons in more tab was grey, which is Apple's default.
But from iOS 8 and later, the colour of those icons are changed to blue.
Expected:
I want the icons colour in the more tab to be grey.
I have tried multiple solutions related to UITabBar icon's images, but no one worked.
I have attached the images for both iOS7 and iOS8-and-later.
Try changing your application's global tint color. If you are using Storyboards, this option is available in the Documents section of the File Inspector.
According to Apple's documentation here, "If you don’t specify a tint for the window, it uses the system default color."

Resources