How can I give different background colors to segments in a segmented control
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Check out UISegmentedControl’s
tintcolorproperty (Apple documentation is linked for you).This only works is the style of the segmented control is
UISegmentedControlStyleBar, though.Otherwise, you might be able to fake it by putting in colored background images via the
- (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetricsmethod, but I’ve never tried this and don’t know if this would do what you want.