1

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:

enter image description here

This is what I had in iOS 12 and would like to get on iOS 13 as well: enter image description here

To add: I've already implemented the next code to opt-out of dark mode:

<key>UIUserInterfaceStyle</key>
<string>Light</string>
Tom Spee
  • 9,209
  • 5
  • 31
  • 49
  • I just tried playing around with a template image inside a segment control, but couldn't find a quick solution. It seems that the system tints them by default to black when in light mode, and into white when in dark mode. You could take a look at this post, and maybe try one of the existing solutions: [post](https://stackoverflow.com/questions/56436559/how-to-change-the-colors-of-a-segment-in-a-uisegmentedcontrol-in-ios-13) – Starsky Oct 11 '19 at 07:45
  • I failed to find a reasonable solution, ended up with a custom control: https://github.com/yonat/MultiSelectSegmentedControl . – Yonat Oct 11 '19 at 08:55
  • @Starsky I've tried the solutions and answers given there, no luck yet. That's why I've created the barebone project to test with. – Tom Spee Oct 11 '19 at 11:20
  • If you forgot to add those lines so that’s not my mistake. Please write proper questions if you are expecting proper answer. – Ravish Kumar Oct 12 '19 at 12:17

2 Answers2

2

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

NSGodMode
  • 599
  • 1
  • 6
  • 16
-3

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>
Ravish Kumar
  • 239
  • 2
  • 12