Klas Zetterlund Klas Zetterlund - 3 months ago 7
iOS Question

Font lost when simulating on iPad

I have a label in my app that works in all screen sizes. The text uses a custom font. So far so good.

When I run the app on an iPad the text becomes too small so I created a font size that only applies to regular height regular width. This looks fine in the storyboard but when I simulate as an iPad it loses the font and size. This does not happened when I use another font.

I have cleared and restarted Xcode. I made sure the font is in

Info.plist
and that the project is selected in Target membership.

What could be wrong?

Answer

Choose System Font in storyboard for size classes. Change your Font in code.

enter image description here

self.yourLabel.font = [UIFont fontWithName:@"Custom regular Font" size:self.yourLabel.font.pointSize];

This is sort of a bug in size classes.