Appearance的使用场合
- 只要后面带有
UI_APPEARANCE_SELECTOR
的方法或者属性,都可以通过appearance对象统一设置 - 比如
@interface UISwitch : UIControl <NSCoding>
@property(nullable, nonatomic, strong) UIColor *onTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
@end
UISwitch *s = [UISwitch appearance];
s.onTintColor = [UIColor redColor];