How do I handle iPhone 6S Plus's font size?

早过忘川 提交于 2019-12-10 03:54:49

问题


iPhone 6S Plus's screen is very big compared to other screen sizes. I can't seem to find a good way to handle the font size of a label without adjusting the size programmatically.

How can I adjust the font size of a label so that it looks smaller on an iPhone 5 and bigger on an iPhone 6 Plus?


回答1:


Don't change font sizes for the iPhone 6 or iPhone 6+.

People buy these phones to see more content. The 6+ displays things slightly bigger than the other phones anyway (yes, it has bigger pixels, not just more pixels), and if a user wants an even bigger display they can switch the whole phone to zoom mode (both 6+ and 6; this turns a 6+ into a large 6, and a 6 into a large 5).

Just use autolayout to position things relative to the screen size.




回答2:


You can't target iPhone 6 Plus using AutoLayout because it's not meant for hardcoding sizes. You either need to use code and do something like this:

if UIScreen.mainScreen().bounds.size.width == 375 {
    // iPhone 6
    label.font = label.font.fontWithSize(20)
}

or just create a invisible view and set top and bottom constraints to it.




回答3:


I think it is better to use adaptive fonts (here is an example, section Adaptive Fonts)



来源:https://stackoverflow.com/questions/27828038/how-do-i-handle-iphone-6s-pluss-font-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!