ICRUIAppearance.m 2.17 KB
Newer Older
mei's avatar
mei committed
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
//
//  ICRUIAppearance.m
//  XFFruit
//
//  Created by Xummer on 3/31/15.
//  Copyright (c) 2015 Xummer. All rights reserved.
//

#import "ICRUIAppearance.h"

@interface UILabel (Appearance)

@property (assign, nonatomic) UIColor *labelBackgroundColor UI_APPEARANCE_SELECTOR;

@end

@implementation UILabel (Appearance)
@dynamic labelBackgroundColor;

- (void)setLabelBackgroundColor:(UIColor *)labelBackgroundColor {
    [super setBackgroundColor:labelBackgroundColor];
}

@end

@implementation ICRUIAppearance

+ (void)CustomAppearance {
    if (IBT_IOS7_OR_LATER) {
        UIApplication.sharedApplication.delegate.window.tintColor = ICR_TINTCOLOR;
    }
    
    [[self class] customNavigationbarAppearance];
    [[self class] customTabbarAppearance];
    [[self class] customLableAppearance];
}

+ (void)customNavigationbarAppearance {
陈俊俊's avatar
陈俊俊 committed
39
    [UINavigationBar appearance].barTintColor = GXF_NAVIGAYION_COLOR;
mei's avatar
mei committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
    [UINavigationBar appearance].tintColor = ICR_NAVIBAR_ITEM_COLOR;
    
    //Universal
    NSShadow *shadow = [[NSShadow alloc] init];
    shadow.shadowOffset = CGSizeZero;
    
    [[UINavigationBar appearance] setTitleTextAttributes:
     @{ NSForegroundColorAttributeName: ICR_NAVIBAR_TITLE_COLOR,
        NSFontAttributeName: [UIFont boldSystemFontOfSize:20],
        NSShadowAttributeName: shadow}];

}

+ (void)customTabbarAppearance {
    if (IBT_IOS7_OR_LATER) {
        [[UITabBar appearance] setBarTintColor:ICR_TABBAR_TINT_COLOR];
    }
    else {
        [[UITabBar appearance] setTintColor:ICR_TABBAR_TINT_COLOR];
    }
    
    UIImage *selTab = [[UIImage imageNamed:@"TabbarSelectedBG"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    CGSize tabSize = CGSizeMake(IBT_MAIN_SCREEN_WIDTH/4, 49);
    UIGraphicsBeginImageContext(tabSize);
    [selTab drawInRect:CGRectMake(0, 0, tabSize.width, tabSize.height)];
    UIImage *reSizeImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    [[UITabBar appearance] setSelectionIndicatorImage:reSizeImage];
}

+ (void)customLableAppearance {
    
    if (IBT_IOS7_OR_LATER) {
        
    }
    else {
        [[UILabel appearance] setLabelBackgroundColor:[UIColor clearColor]];
    }
}


@end