在 iOS 8 之后 Apple 引入了对开发者非常有帮助的尺寸等级。但是他们为所有 iPhone(iPhone 4s、iPhone 5、iPhone 5s、iPhone 6)和 iPhone 6 plus 提供了不同的字体大小,那么在 iPhone 5 和 iPhone 6 中是否有任何可能的正确方法来做同样的事情......
我不要支票,请像这样 Set different font size for iPhone 5 and 6
非常感谢您提供合适的最佳答案。
最佳答案
使用下面的宏-
// I assume that iPhone 5 Font size 17.0 and iPhone 6 font size 25.0 and default font size 12.0
#define kFONTSize ([UIScreen mainScreen].bounds.size.height == 568 ? 17.0 :[UIScreen mainScreen].bounds.size.height == 667? 25.0: 12.0)
#define kFONT_DEFINE [UIFont fontWithName:AVENIR_LTPRO size:kFONTSize]
txtView.font = kFONT_DEFINE;
希望对你有帮助
关于ios - 在 iphone 5 和 iphone 6 中动态设置字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30389345/