iOS @property之后跟着UI_APPEARANCE_SELECTOR
来源:互联网 发布:七氟烷的mac值是多少 编辑:程序博客网 时间:2024/05/28 23:21
appearance是apple在iOS5.0上加的一个协议,它让程序员可以很轻松地改变某控件的全局样式(背景)
@selector(appearance)
支持UIAppearance协议的类可以访问appearance selector ,它为receiver返回appearance proxy,我么可以给proxy发一些消息,诸如setTintColor:等
但是它并不是支持所有的UI类。下面列出它支持的类
1.UIActivitiIndicatorView
2.UIBarButtonItem
3.UIBarItem
4.UINavgationBar
5.UIPopoverControll
6.UIProgressView
7.UISearchBar
8.UISegmentControll
9.UISlider
10.UISwitch
11.UITabBar
12.UITabBarItem
13.UIToolBar
14.UIView
15.UIViewController
例如:
[[UINavigationBarappearance] setTintColor:[UIColorblackColor]];
[[UISearchBarappearance] setTintColor:[UIColorblackColor]];
特殊地:
开关控件 @property(nullable, nonatomic, strong) UIColor *onTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
可以统一设置开关的onTintColor样式.不过开关控件的颜色属性比较特殊
1.只在添加时作用一次.
2.添加结束后.
3.以后设置便不再改变.
4.也可以移出开关的父控件.而把开关从新加入到window上.
在iOS属性后有UI_APPEARANCE_SELECTOR标志都可以一次性统一设置.这种情况还有很多.比如说统一设置UITabbarItem的文字颜色 方法如下:
- (void)setTitleTextAttributes:(nullable NSDictionary*)attributes forState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
原文链接:http://www.jianshu.com/p/f9acef0956b4
- iOS @property之后跟着UI_APPEARANCE_SELECTOR
- iOS UI_APPEARANCE_SELECTOR
- UI_APPEARANCE_SELECTOR
- UI_APPEARANCE_SELECTOR
- iOS UI_APPEARANCE_SELECTOR、appearence 和UIButton加图片并调整图片和字体的位置
- IOS property
- IOS @property
- IOS @property
- IOS @property
- ios property
- IOS @property
- ios -- @property
- ios -- @property
- ios property
- iOS @property
- ios property详解
- iOS -- @property属性说明
- [iOS] ARC, @property 关键字
- SA后缀数组模板
- 十三周项目4
- 1216
- tslib库的安装
- 【AI每日播报】Uber无人车首次上路便闯红灯
- iOS @property之后跟着UI_APPEARANCE_SELECTOR
- 智慧北京[上篇]
- IO流
- Flex版本时钟开发小记
- 易语言中动态地址的理解
- WPF默认数据绑定可以自动进行数据格式验证
- 在ASP.NET(C#)中查询字符串Like拼接where字段的方法
- 十五周项目3
- 前端jquery即时验证问题