Vyacheslav Vyacheslav - 5 months ago 30
iOS Question

UIFont fontWithSize: changes the fontName

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?

Answer

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

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

Comments