This is enough.
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont boldSystemFontOfSize:17], UITextAttributeFont,
[UIColor blackColor], UITextAttributeTextColor,
nil];
[_segment setTitleTextAttributes:attributes forState:UIControlStateNormal];
NSDictionary *highlightedAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:UITextAttributeTextColor];
[_segment setTitleTextAttributes:highlightedAttributes forState:UIControlStateHighlighted];
If you want to change the color when the segment change
- (IBAction)horseSegmentChanged:(UISegmentedControl*)sender {
if (sender.selectedSegmentIndex == 0) {
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont boldSystemFontOfSize:17], UITextAttributeFont,
[UIColor blackColor], UITextAttributeTextColor,
nil];
[_segment setTitleTextAttributes:attributes forState:UIControlStateNormal];
NSDictionary *highlightedAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:UITextAttributeTextColor];
[_segment setTitleTextAttributes:highlightedAttributes forState:UIControlStateHighlighted];
} else if (sender.selectedSegmentIndex == 1) { // selected shared blogs
}
}