我在使用UISegmentedControl时遇到了一些问题,无法显示所需的色调颜色。
// AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// need red tint color in other views of the app
[[UIView appearance] setTintColor:[UIColor redColor]];
return YES;
}
// ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSArray *items = @[@"Item 1", @"Item 2"];
UISegmentedControl *control = [[UISegmentedControl alloc] initWithItems:items];
// would like to have this control to have a green tint color
control.tintColor = [UIColor greenColor];
[self.view addSubview:control];
}
如何使 UISegmentedControl 使用绿色调色板?
[[UISegmentedControl appearance] setTintColor:[UIColor greenColor]];
- BoilingLimeUISegmentControl
的每个子视图设置颜色? - BoilingLime