Reputation: 2601
I would like to know if there is an easy way to change the font of all labels, textviews, buttons, talbeviewcells, etc... in a StoryBoard programmatically, without adding them in the viewcontroller?
I do it manually for now, but I wonder if an easy solution exists?
Upvotes: 0
Views: 63
Reputation: 100503
Try this in code
Swift
UILabel.appearance().defaultFont = UIFont.systemFont(ofSize: 25)
UPDATE:
Obj-c (without changing the size):
Put at the beginning:
@implementation UILabel(SizedFontName)
- (void)setSizedFontName:(NSString *)name UI_APPEARANCE_SELECTOR
{
self.font = [UIFont fontWithName:name size:self.font.pointSize];
}
@end
In the viewDidLoad:
[[UILabel appearance] setSizedFontName:@"RenaultLife"];
Upvotes: 3