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

前端 未结 14 1278
隐瞒了意图╮
隐瞒了意图╮ 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:24

    None of these worked for me, but this did. You also need to use the system font in IB

    #import 
    
    @interface UILabelEx : UILabel
    
    
    @end
    
    #import "UILabelEx.h"
    #import "Constants.h"
    
    @implementation UILabelEx
    
    - (void) traitCollectionDidChange: (UITraitCollection *) previousTraitCollection {
        [super traitCollectionDidChange: previousTraitCollection];
    
        self.font = [UIFont fontWithName:APP_FONT size:self.font.pointSize];   
    }
    @end
    

提交回复
热议问题