【UIKit】-11-UIAppearance - 全局设置,整个 app 统一

来源:互联网 发布:淘宝社区首页 编辑:程序博客网 时间:2024/06/08 03:42

    请注意*使用appearance设置UI效果最好采用全局的设置,在所有界面初始化前开始设置,否则可能失效。


参考
http://blog.sina.com.cn/s/blog_9693f61a0101f1rs.html
http://www.cocoachina.com/ios/20150720/12671.html

暂无实例

A class must adopt the UIAppearance protocol to allow appearance customization using the UIAppearance API. To participate in the appearance proxy API, tag appearance property accessor methods in your header with UI_APPEARANCE_SELECTOR. Appearance property accessor methods must be of the form:
一个类必须采取UIAppearance协议使用UIAppearance API,允许自定义外观。参加的外观代理API中,在你与UI_APPEARANCE_SELECTOR头标记的外观属性访问方法。

 

#import<Foundation/Foundation.h>

 

@classUITraitCollection;

 

#define UI_APPEARANCE_SELECTOR __attribute__((annotate("ui_appearance_selector")))

 

@protocolUIAppearanceContainer <NSObject>@end

 

@protocol UIAppearance<NSObject>

 

+ (instancetype)appearance;

 

+ (instancetype)appearanceWhenContainedIn:(Class <UIAppearanceContainer>)ContainerClass, ...NS_REQUIRES_NIL_TERMINATION;

 

+ (instancetype)appearanceForTraitCollection:(UITraitCollection *)traitNS_AVAILABLE_IOS(8_0);

+ (instancetype)appearanceForTraitCollection:(UITraitCollection *)traitwhenContainedIn:(Class <UIAppearanceContainer>)ContainerClass, ...NS_REQUIRES_NIL_TERMINATION NS_AVAILABLE_IOS(8_0);

 

@end

 


0 0
原创粉丝点击