How to support dynamic type in labels in iOS 7?

前端 未结 2 1415
隐瞒了意图╮
隐瞒了意图╮ 2021-01-31 03:29

How do I support Dynamic Type in UILabel and UITextView in iOS 7? I\'m adapting one of our projects for iOS 7 and would like to support this accessibil

2条回答
  •  醉梦人生
    2021-01-31 03:42

    In Swift 3 and iOS 10 you can use

    headline.font = UIFont.preferredFont(forTextStyle: UIFontTextStyleHeadline)
    headline.adjustsFontForContentSizeCategory = true
    

    See this excellent post for more information, especially how to support pre iOS 10.

提交回复
热议问题