iOS documentation of UIAppearanceContainer
Protocol Reference says:
"To participate in the appearance proxy API, tag your appearance property accessor methods in your header with UI_APPEARANCE_SELECTOR."
But when I, for example, open UIButton.h, I can't find anywhere UI_APPEARANCE_SELECTOR
, although I can use something like this wihout problems:
[[UIButton appearance] setBackgroundImage:[[UIImage imageNamed:@"UIButton"] resizableImageWithCapInsets:UIEdgeInsetsMake(5.0, 5.0, 5.0, 5.0)] forState:UIControlStateNormal];
Can anyone tell me what's going on :D ?
You can't find it because the accessor is inherited from UIView
(UIButton
inherits from; UIControl
: UIView
: UIResponder
: NSObject
).
So when you're doing [UIButton appearance]
you get the appearance proxy for the passed class, just because UIView
adopts the UIAppearance
and UIAppearanceContainer
protocols. I hope that this makes sense.
PS. If you look for example UIBarButtonItem
's header file, you will see that the UI_APPEARANCE_SELECTOR
is there.