Skip to content

Latest commit

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

MZAppearance

UIAppearance proxy for custom objects

How To Use

All you need is mark a method that participates in the appearance proxy API using MZ_APPEARANCE_SELECTOR. Implement protocol method + (id)appearance, and call applyInvocationTo inside your init or viewDidLoad object method.

@interfaceMZViewController : UIViewController <MZApperance>
@property (nonatomic,strong) UIColor *customColor MZ_APPEARANCE_SELECTOR;
@property (nonatomic,assign) CGFloat customFloat MZ_APPEARANCE_SELECTOR;
+ (id)appearance;
@end
+ (id)appearance
{
return [MZAppearance appearanceForClass:[selfclass]];
}
- (void)viewDidLoad
{
[superviewDidLoad];
[[[selfclass] appearance] applyInvocationTo:self];
NSLog(@"custom color: %@",self.customColor);
NSLog(@"custom float: %f",self.customFloat);
}

How to setup appearance variable

[[MZViewController appearance] setCustomColor:[UIColor blackColor]];
[[MZViewController appearance] setCustomFloat:6.0];

Console result will be

2013-08-1719:59:38.546 MZAppearance[3374:c07] custom color: UIDeviceWhiteColorSpace 012013-08-1719:59:38.547 MZAppearance[3374:c07] custom float: 6.000000

About

UIAppearance proxy for custom objects

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors