Custom Font Sizing in Xcode 6 Size Classes not working properly with Custom Fonts

前端 未结 14 1273
隐瞒了意图╮
隐瞒了意图╮ 2020-11-29 17:42

Xcode 6 has a new feature where fonts and font sizes in UILabel, UITextField, and UIButton can be s

14条回答
  •  死守一世寂寞
    2020-11-29 18:27

    The bug is still valid in XCode 7.0 GM.

    Razor28's solution causes infinite loops in some cases. My experience has been with using it in conjunction with SwipeView.

    Instead, I suggest that you:

    1) Subclass UILabel and override setFont:

    - (void)setFont:(UIFont *)font
    {
        font = [UIFont fontWithName:(@"Montserrat") size:font.pointSize];
        [super setFont:font];
    }
    

    2) Set the custom class of your UILabels and then set the font size classes by using System font

提交回复
热议问题