123 123 - 3 months ago 19
Swift Question

How to increase font size of label Apple Watch

I'm kind of stunned I even have to ask this question, but how is it possible to change the size of a label's text on the Apple watch? It doesn't allow changing the size in the Xcode UI, I haven't been able to do it programmatically, and the different font styles don't even change the size.

Answer

With UI

To change the font, you can't use the main template (Text Styles - Body). You should change it to "System", and then try to change font size:

enter image description here

enter image description here

With Code

lblSomething.setAttributedText(NSAttributedString(string: "Text Here", attributes: [NSFontAttributeName: UIFont.systemFontOfSize(20.0, weight: UIFontWeightBold)]))

Notes

1- Instead of 20.0, you should use your own font size.

2- Instead of UIFontWeightBold, you could use one of the following:

enter image description here

3- Instead of "Text Here", use your own text.

4- Instead of lblSomething, use your label name.