UISegmentedControl is darkening image color for unselected segments-breaks dark mode

UISegmentedControl is using darkened image color for both selected/unselected segments - iOS 13 beta 6. I'm using UIImages in a UISegmentedControl that displays play/pause/stop controls:



  // play, pause, stop buttons are white on transparent background.  Issue is that all are displayed as black.

  segmentedControl = [[UISegmentedControl alloc] initWithItems:
  [NSArray arrayWithObjects:
  [UIImage imageNamed:@"play.png"],
  [UIImage imageNamed:@"pause.png"],
  [UIImage imageNamed:@"stop.png"],

  nil]];

  segmentedControl.backgroundColor = [UIColor blackColor];


The image is white on transparent background. On iOS <=12 the image would be displayed unchanged in unselected segments of a UISegmentedControl--but it would be darkened automatically for any selected segment, so it would standout from the selected segment color (white).


On iOS 13 beta 1-6 all the segments, selected and unselected, are using a darkened variant. So the white play/stop/buttons are being displayed as black on a black background--so they're invisible in a dark mode UI.


Has anyone else encountered this issue?


It’s logged as FB 6944724 through Feedback assistant.

Replies

Wondering if it happens only with png? Curious what the result would be if these were replaced with equivalent Apple SF Symbols, which should be dark/light mode friendly. I realize this isn't a solution, but might be a good datapoint.

Segmented controls changed their appearance a lot in iOS 13. Any customisations you were making (such as setting the black background in your sample code) might be the wrong choice in iOS 13. It depends whether you want to embrace the new style or not. I would also investigate whether your images are tinted or not (or maybe images shown in a segmented control are always tinted?)


A "white" image that is tinted is only using the alpha component - the fact the image is white is irrelevant if it is then tinted with a black tint color. Setting the tintColor property on the segmented control should affect that, but will possibly interfere with the new selection "bubble" in iOS 13 (which is white by default in light mode). That bubble can be changed with the selectedSegmentTintColor.