Last active
December 13, 2015 23:39
-
-
Save cliftonlabrum/4993012 to your computer and use it in GitHub Desktop.
Objective-C Class for Multiple Colors and Fonts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//--- PPColor.m --- | |
@implementation PPColor | |
+ (UIColor *)grayColor { | |
return [UIColor colorWithRed:0.35 green:0.35 blue:0.35 alpha:1.0]; | |
} | |
+ (UIColor *)darkGrayColor { | |
return [UIColor colorWithRed:0.13 green:0.13 blue:0.13 alpha:1.0]; | |
} | |
+ (UIColor *)blueColor { | |
return [UIColor colorWithRed:0.33 green:0.67 blue:0.90 alpha:1.0]; | |
} | |
@end | |
//--- PPFont.h --- | |
@interface PPFont : NSObject | |
+ (UIFont *)regular; | |
+ (UIFont *)regularWithSize:(CGFloat)size; | |
+ (UIFont *)bold; | |
+ (UIFont *)boldWithSize:(CGFloat)size; | |
@end | |
//--- PPFont.m --- | |
#import "PPFont.h" | |
@implementation PPFont | |
+ (UIFont *)regular { | |
return [self regularWithSize:18.0f]; | |
} | |
+ (UIFont *)regularWithSize:(CGFloat)size { | |
return [UIFont fontWithName:@"ProximaNova-Regular" size:size]; | |
} | |
+ (UIFont *)bold { | |
return [self boldWithSize:18.0f]; | |
} | |
+ (UIFont *)boldWithSize:(CGFloat)size { | |
return [UIFont fontWithName:@"ProximaNova-Bold" size:size]; | |
} | |
@end | |
//--- Usage --- | |
- (void) style{ | |
self.view.backgroundColor = [UIColor blueColor]; | |
self.headerContainer.backgroundColor = [UIColor blueColor]; | |
_feedbackButton.titleLabel.font = [PPFont boldWithSize:18.0f]; | |
[_feedbackButton setTitleColor:[PPColor grayColor] forState:UIControlStateNormal]; | |
_appStoreLabel.font = [PPFont boldWithSize:16.0f]; | |
_appStoreLabel.textColor = [UIColor colorWithRed:0.51 green:0.51 blue:0.51 alpha:1.0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment