views:

3164

answers:

1

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];
+1  A: 

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?

Dave
Thanks - exactly what I needed (and so simple "once you know how")
CraigD