ΩlostA
ΩlostA

Reputation: 2601

iOS: Is there a way to set programmatically all the fonts of the storyboard in a specific font?

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?

enter image description here

Upvotes: 0

Views: 63

Answers (1)

Shehata Gamal
Shehata Gamal

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

Related Questions