美文网首页
关于ios appearance

关于ios appearance

作者: Mr_Dragonn | 来源:发表于2016-05-25 10:39 被阅读1090次

+ (id)appearance
这个方法是统一全部改,比如你设置UINavBar的tintColor,你可以这样写:[[UINavigationBar appearance] setTintColor:myColor];

但是它并不是支持所有的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

注意:
  初学者肯定会任意调用方法,大部分方法时无效的,如果调用时会抛出unknown selector 异常
  那么如何查看你调用的方法时有效的呢,我们可以在此类的头文件中查看包含“UI_APPEARANCE_SELECTOR”常量的方法。

例如UIToolBar
它支持下列方法
*@property(nonatomic,retain) UIColor tintColor UI_APPEARANCE_SELECTOR;
*- (void)setBackgroundImage:(UIImage )backgroundImage forToolbarPosition:(UIToolbarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
*- (UIImage )backgroundImageForToolbarPosition:(UIToolbarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
*- (void)setShadowImage:(UIImage )shadowImage forToolbarPosition:(UIToolbarPosition)topOrBottom NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
*- (UIImage )shadowImageForToolbarPosition:(UIToolbarPosition)topOrBottom NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;

相关文章

网友评论

      本文标题:关于ios appearance

      本文链接:https://www.haomeiwen.com/subject/snqtdttx.html