Norway


I’m all my views and while I’ve got most of the elements scaling well, one thing I’m struggling with is how to properly labels sizes on the .

For example, I the user’s name in a label with this font:

UIFont(name: "Futura-Medium", size: 27)

It looks great on most of the recent iPhone models, but when I build onto the iPad simulators the font is far too while on the iPhone 5s the font is far too large.

The research I’ve done so far suggests that I can use this to change the font size at runtime:

label.font = label.font.withSize(##)

The problem is I’m not quite sure how I would calculate the new size of the font based on the screen size in a way that would look good on all screen sizes.

Am I way off base here? Is there a much simpler way of doing this? Most of the questions and tutorials I’ve seen so far give answers based on creating views inside the storyboard.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here