README.md 1.37 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
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 <MZAppearance> protocol method + (id)appearance, and call applyInvocationTo inside your init or viewDidLoad object method.

``` objective-c
@interface MZViewController : UIViewController <MZApperance>

@property (nonatomic,strong) UIColor *customColor MZ_APPEARANCE_SELECTOR;
@property (nonatomic,assign) CGFloat customFloat MZ_APPEARANCE_SELECTOR;

+ (id)appearance;

@end
```

``` objective-c
+ (id)appearance
{
    return [MZAppearance appearanceForClass:[self class]];
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    [[[self class] appearance] applyInvocationTo:self];
    
    NSLog(@"custom color: %@",self.customColor);
    NSLog(@"custom float: %f",self.customFloat);
}
```

## How to setup appearance variable

``` objective-c
[[MZViewController appearance] setCustomColor:[UIColor blackColor]];
[[MZViewController appearance] setCustomFloat:6.0];
```

Console result will be

``` objective-c
2013-08-17 19:59:38.546 MZAppearance[3374:c07] custom color: UIDeviceWhiteColorSpace 0 1
2013-08-17 19:59:38.547 MZAppearance[3374:c07] custom float: 6.000000
```




[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/m1entus/mzappearance/trend.png)](https://bitdeli.com/free "Bitdeli Badge")