iOS 5: Curious about UIAppearance

后端 未结 3 1530
一生所求
一生所求 2020-11-30 19:26

On the tech talk 2011 I saw a speech about the new UIAppearance protocol. There is not a lot of documentation out there yet. I will shortly summarize what I re

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 20:09

    a: The following line

     [[UITableView appearance] setBackgroundColor:[UIColor blueColor]];
    

    Will make every table view blue! Just tested on iOS 5 simulator.

    b: The UIAppearance should work on every property on a UIView. All the subclasses of UIView conforms to UIAppearance Protocol

    c: I think that the most of will create an class and or method that will customize the appearance and will call it in:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

    Something like: [ApplicationAppearance setApplicationSchemaTo:ASchemaBlue];

    Edit:

    For example, UIBarButtonItem defines these methods:

    @property(nonatomic,retain) UIColor *tintColor UI_APPEARANCE_SELECTOR;

    From UIAppearanceContainer Protocol Reference

    And in the UIBarButtonItem Class Reference the tintColor is defined

    @property(nonatomic, retain) UIColor *tintColor

    But in the UIBarButtonItem.h is defined:

    @property(nonatomic,retain) UIColor *tintColor __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;
    

    I think that the docs are not up to date.

提交回复
热议问题