【问题标题】:Dynamically Set the Font size in iphone 5 and iphone 6在 iphone 5 和 iphone 6 中动态设置字体大小
【发布时间】:2015-08-04 01:01:07
【问题描述】:

在 iOS 8 之后,Apple 引入了对开发者非常有帮助的 size classes。但是他们为所有 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

非常感谢您的合适和最佳答案。

【问题讨论】:

    标签: ios fonts iphone-5 iphone-6


    【解决方案1】:

    使用下面的宏-

    // 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; 
    

    希望对你有帮助

    【讨论】:

    猜你喜欢
    • 2015-07-21
    • 2016-01-14
    • 2016-04-15
    • 2016-10-21
    • 2015-08-16
    • 1970-01-01
    • 2021-06-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多