Reputation: 13942
How to set font color of UISegmentedControl for iPhone ios 4.3?
For ios 5.0 i use
UISegmentedControl *button = [[[UISegmentedControl alloc]
initWithItems:[NSArray >arrayWithObjects:itemTitle, nil]] autorelease];
NSDictionary *attributes = [NSDictionary dictionaryWithObject:fontColor forKey:UITextAttributeTextColor];
[button setTitleTextAttributes:attributes forState:UIControlStateNormal];
button.momentary = YES;
button.segmentedControlStyle = UISegmentedControlStyleBar;
button.tintColor = tintColor;
Upvotes: 0
Views: 1729
Reputation: 43330
It might not be such a bad idea to use a custom project, especially because OS 4.x doesn't have the deep UIKit customization possible in 5.x. Here's an excellent one in Github which actually solves both of your requirements for setting both the size and color of the UIControl: Here
EDIT: it looks like the project automatically chooses the font color to match the selected color. At least it's a start.
Upvotes: 1