Jai
Jai

Reputation: 61

UIlabel Font Size issue for iPhone 5, 6 , 6 plus

I am using Xcode 7.3.1 to develop application for all iPhone sizes (5,6, 6plus). I am having problem with UIlabel font size. For iPhone 5 the UIlabel font size is way too big and for iPhone 6 Plus its too small. Have anyone faced the same problem with font size. By the way I am using storyboard and don't wanna set font size programatically with If-else condition. Please suggest best way to handle this.

Thanks

Upvotes: 3

Views: 889

Answers (3)

Ahmad Ishfaq
Ahmad Ishfaq

Reputation: 914

So this is a problem made to be handled through size classes but you can currently only specify different fonts for iphone landscape,portrait or ipad landscape,portrait etc.If you want to change fonts for one orientation on iphone than you have to do it programmatically. The best way to do it will be to create a custom UILabel class and in it's awakefromnib method come up with a formula for fonts and assign the font their e.g

self.font = [UIFont fontWithName:@"CustomFont" size:self.font.pointSize * [currentviewwidth/viewwidthofxib/storyboard]];

Upvotes: 2

Neha Gupta
Neha Gupta

Reputation: 157

To resolve this issue, Set MinimumFontSize for that label in storyboard/xib

Upvotes: 0

Bhadresh Mulsaniya
Bhadresh Mulsaniya

Reputation: 2640

I think you are missing to add launch image for all device resolution.

Upvotes: 0

Related Questions