IOS 7 UISegmentControl set tint color not working. How am I going to solve it?
Here is my code for adding:
UISegmentedControl *segmentControl = [[UISegmentedControl alloc] initWithItems:[NSMutableArray arrayWithObjects:@"YES",@"NO", nil]];
[segmentControl setTintColor:[UIColor orangeColor]];
but the color only appear at border, i want it to color whole background.
As I referred from the Library,
@property(nonatomic) UISegmentedControlStyle segmentedControlStyle NS_DEPRECATED_IOS(2_0, 7_0, "The segmentedControlStyle property no longer has any effect");*
The UISegmentedControl relates to the tint color of the UINavigationBar. If you change the color, the tint color of the UISegmentedControl will change accordingly.
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
I think you may want:
[segmentControl setBackgroundColor:[UIColor orangeColor]];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.