iPhone, how to get a black segmented control

Fact: there’s no way to tint a segmented control in Interface Builder. It looks like Apple’s guys prefer to code such things, because it’s not the only shortcoming when it gets to iPhone interface creation.

You’d have to style your segment controls programatically through the tintColor property. Now isn’t that annoying? 

The main drawback is that when they’re black, there’s no “darker” color of black. So all the segments are the same color. What you can do is imagine how it would look. Then go and make your segmented control dark gray.

We’re placing segmented controls on translucent navigation bars. I’ve read on a forum that setting [UIColor clearColor] for the tint should work, but haven’t test it yet.

This entry was posted in Blogosphere, General, iPhone and tagged . Bookmark the permalink.

4 Responses to iPhone, how to get a black segmented control

  1. Joel says:

    The forum discussion linked to spells it out pretty well. In short, using [mySegmentedControl setTintColor:[UIColor darkGrayColor]] will in fact yield a segmented controller that matches a standard button on a black toolbar with the selected segment “highlighted” in black. Thanks for the post!

  2. Scott says:

    Thank you, thank you, thank you!

  3. ben says:

    Just use:

    [actionControl setTintColor: [UIColor colorWithRed:0.40 green:0.40 blue:0.40 alpha:.7]];

  4. newbieIPhoney says:

    Thanks a lot Ben!!

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>