UIAppearance

1> 只要遵守了UIAppearance协议,还要实现这个方法才能调用appearance相关方法

2> 只有被UI_APPEARANCE_SELECTOR宏修饰的属性,才能设置

// 获取整个应用程序下的UITabBarItem
UITabBarItem *item = [UITabBarItem appearance];
    
// 获取某个类中的UITabBarItem
UITabBarItem *item = [UITabBarItem appearanceWhenContainedIn:self, nil];

3> 只能在控件显示之前设置才有作用

/*
   使用场景:切换夜间模式 
    
    移除整个view后,重新添加,达到刷新界面的效果
*/
[self.view removeFromSuperview];

[[UIApplication shareApplication].keyWindow addSubview:self.view];

 

posted @ 2016-05-18 15:34  兔.小白  阅读(210)  评论(0编辑  收藏  举报