Question

I have a UISegmentedControl on a black UIToolbar. I have set the style to Bar and set the background color to clear (also tried black). I have tried setting the tintColor clear (also tried black). My buttons turn black to match the black UIToolbar. However, the buttons no longer indicate a clicked state like they do when the UISegmentedControl is the default blue/grey. What do I have to do to make the buttons indicate a black/grey clicked state? Please let me know. Code used so far to set the color of the UISegmentedControl:

viewTypeSelection.segmentedControlStyle = UISegmentedControlStyleBar;
viewTypeSelection.backgroundColor = [UIColor clearColor];
Was it helpful?

Solution

While not a perfect solution, this works pretty well

    // set the color
viewTypeSelection.segmentedControlStyle = UISegmentedControlStyleBar;
viewTypeSelection.tintColor = [UIColor darkGrayColor];

The buttons have state change and it looks OK. Here is a post that has a few more details and might help someone looking for a similar solution:

UISegmentedControl black?

OTHER TIPS

You may have set the color of the bar with tintColor instead of setting barStyle like so:

self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top