设置类的所有实例的外观

要自定义类的所有实例的外观,请访问所需类的外观代理。例如:

设置 UIButton 色调

迅速:

UIButton.appearance().tintColor = UIColor.greenColor()

Objective-C 的:

[UIButton appearance].tintColor = [UIColor greenColor];

设置 UIButton 背景颜色

迅速:

UIButton.appearance().backgroundColor = UIColor.blueColor()

Objective-C 的:

[UIButton appearance].backgroundColor = [UIColor blueColor];

设置 UILabel 文本颜色

迅速:

UILabel.appearance().textColor = UIColor.redColor()

Objective-C 的:

[UILabel appearance].textColor = [UIColor redColor];

设置 UILabel 背景颜色

迅速:

UILabel.appearance().backgroundColor = UIColor.greenColor()

Objective-C 的:

[UILabel appearance].backgroundColor = [UIColor greenColor];

设置 UINavigationBar 色彩

迅速:

UINavigationBar.appearance().tintColor = UIColor.cyanColor()

Objective-C 的:

[UINavigationBar appearance].tintColor = [UIColor cyanColor];

设置 UINavigationBar 背景颜色

迅速:

UINavigationBar.appearance().backgroundColor = UIColor.redColor()

Objective-C 的:

[UINavigationBar appearance].backgroundColor = [UIColor redColor];