Reputation: 2095
In my WatchKit layout I need to have a monospaced font. Do I have to add a monospaced font or is there any trick to use the system font?
Upvotes: 0
Views: 319
Reputation: 16447
You can use the system font (San Fransisco) which has a monospaced variant.
For WKInterfaceLabel
, this is not a visible option in interface builder, and you cannot access the font
property, so you must use an attributed string to set it:
UIFont *monospacedFont = [UIFont monospacedDigitSystemFontOfSize:36.0 weight:UIFontWeightRegular];
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:@"12:34:56"
attributes:@{NSFontAttributeName: monospacedFont}];
[self.label setAttributedText:attributedString];
Upvotes: 1