Created
May 30, 2012 12:00
-
-
Save advantis/2835817 to your computer and use it in GitHub Desktop.
UILabel category for setting custom font in IB
This file contains 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
// | |
// Copyright © 2012 Yuri Kotov | |
// | |
#import <UIKit/UIKit.h> | |
@interface UILabel (NibFont) | |
@property (nonatomic, copy) NSString *fontName; | |
@property (nonatomic) CGFloat fontSize; | |
@end |
This file contains 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
// | |
// Copyright © 2012 Yuri Kotov | |
// | |
#import "UILabel+NibFont.h" | |
@implementation UILabel (NibFont) | |
- (NSString *) fontName | |
{ | |
return self.font.fontName; | |
} | |
- (void) setFontName:(NSString *)name | |
{ | |
self.font = [UIFont fontWithName:name size:self.fontSize]; | |
} | |
- (CGFloat) fontSize | |
{ | |
return self.font.pointSize; | |
} | |
- (void) setFontSize:(CGFloat)size | |
{ | |
self.font = [UIFont fontWithName:self.fontName size:size]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment