1

if I'm trying to change the size of UIFont it changes the font name (ad type). before: font.fontName is equal to @".SFUIText-Regular"

execute this: font = [font fontWithSize:size];

after: font.fontName is equal to @".SFUIDisplay-Regular"

Why? How to avoid this?

Patrick
  • 1,629
  • 5
  • 23
  • 44
Vyacheslav
  • 26,359
  • 19
  • 112
  • 194

3 Answers3

1

Try [UIFont systemFontOfSize:36] or [UIFont fontWithName:@"SFUIDisplay-Regular" size:36]

This link may help: only change font size (and not font name)

Community
  • 1
  • 1
Patrick
  • 1,629
  • 5
  • 23
  • 44
1

Why do you want to avoid this? The operating system decided that the font closest to ".SFUIText-Regular" in the size you want is a font named ".SFUIDisplay-Regular". That's entirely within the rules.

Live with it.

gnasher729
  • 51,477
  • 5
  • 75
  • 98
  • I'd like to measure the symbols using the CoreText libraries. These fonts give me different measured width values. – Vyacheslav Mar 31 '16 at 08:17
1

You can go for this

label.font = [label.font fontWithSize:50];
Moin Shirazi
  • 4,372
  • 2
  • 26
  • 38