作用:UIview 有個(gè)屬性叫 TintColor,可以給應(yīng)用著色。
* 所有作為其他視圖的子視圖,存在的UI元素,都會(huì)在未設(shè)置的tintColor 的情況下使用父視圖的 tintcolor。這意味著你可以給應(yīng)用程序的窗口設(shè)置tintcolor就可以全局的著色。 *
注意:如果是 模態(tài)視圖出現(xiàn)時(shí),iOS7 就會(huì)把它后面背景模糊, 自定義一個(gè)視圖的話,并且用了父視圖的tintcolor 來(lái)做一些自定義渲染,就要覆蓋 tintColorDidChange 方法來(lái)更新變化。
-英文說(shuō)明:
The -tintColorDidChange message is sent to appropriate subviews of a view when its tintColor is changed by client code or to subviews in the view hierarchy of a view whose tintColor is implicitly changed when its superview or tintAdjustmentMode changes.
- (void)tintColorDidChange NS_AVAILABLE_IOS(7_0);
設(shè)置導(dǎo)航欄的顏色:
nav.navigationBar.barTintColor = [UIColor redColor ] ; // IOS7.0