[英]IOS 7 UISegmentControl set tint color not working
iOS 7 UISegmentControl设置色调颜色不起作用。 我要如何解决?
这是我添加的代码:
UISegmentedControl *segmentControl = [[UISegmentedControl alloc] initWithItems:[NSMutableArray arrayWithObjects:@"YES",@"NO", nil]];
[segmentControl setTintColor:[UIColor orangeColor]];
但是颜色只出现在边框上,我希望它为整个背景着色。
正如我从图书馆提到的那样,
@property(nonatomic) UISegmentedControlStyle segmentedControlStyle NS_DEPRECATED_IOS(2_0, 7_0, "The segmentedControlStyle property no longer has any effect");*
UISegmentedControl与UINavigationBar的颜色有关。 如果更改颜色,则UISegmentedControl的着色颜色将相应更改。
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
我想您可能想要:
[segmentControl setBackgroundColor:[UIColor orangeColor]];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.