Xcode 6 has a new feature where fonts and font sizes in UILabel
, UITextField
, and UIButton
can be s
This (and other Xcode - Size Classes related) bug caused me some serious grief recently as I had to go through a huge storyboard file hacking things away.
For anyone else in this position, I'd like to add something on top of @razor28's answer to ease the pain.
In the header file of your custom subclass, use IBInspectable
for your runtime attributes. This will make these attributes accessible from the "Attributes Inspector", visually right above the default position for font settings.
Example use:
@interface MyCustomLabel : UILabel
@property (nonatomic) IBInspectable NSString *fontType;
@property (nonatomic) IBInspectable CGFloat iphoneFontSize;
@property (nonatomic) IBInspectable CGFloat ipadFontSize;
@end
This will very helpfully produce this output:
An added benefit is that now we don't have to add the runtime attributes manually for each label. This is the closest I could get to XCode's intended behaviour. Hopefully a proper fix is on its way with iOS 9 this summer.