Custom Fonts for UI components from storyboard can be easily achieved with User Defined Runtime Attributes in storyboard and Categories.
The advantages are like,
Steps to follow
#import <UIKit/UIKit.h>
//Category extension for UILabel
@interface UILabel (IBExtensions)
@property (nonatomic, copy) NSString *fontName;
@end
// Category extension for UITextField
@interface UITextField (IBExtensions)
@property (nonatomic, copy) NSString *fontName;
@end
// Category extension for UIButton
@interface UIButton (IBExtensions)
@property (nonatomic, copy) NSString *fontName;
@end
#import "UIKit+IBExtensions.h"
@implementation UILabel (IBExtensions)
- (NSString *)fontName {
return self.font.fontName;
}
- (void)setFontName:(NSString *)fontName {
self.font = [UIFont fontWithName:fontName size:self.font.pointSize];
}
@end
@implementation UITextField (IBExtensions)
- (NSString *)fontName {
return self.font.fontName;
}
- (void)setFontName:(NSString *)fontName {
self.font = [UIFont fontWithName:fontName size:self.font.pointSize];
}
@end
@implementation UIButton (IBExtensions)
- (NSString *)fontName {
return self.titleLabel.font.fontName;
}
- (void)setFontName:(NSString *)fontName{
self.titleLabel.font = [UIFont fontWithName:fontName size:self.titleLabel.font.pointSize];
}
@end
This will set your custom font while running the app.
Notes: