-->

UIFont possible sizes

2019-08-24 02:21发布

问题:

I am trying in an iPhone app to set the possibility for the user to choose the fonts.

I have already made progress using the UIFont class. Here is my question : When the choice of a Font within a Font Family is made how to I know the possibilities the user has for the size? Is there a way to list them? I did not see anything like that in the UIFont documentation or anywhere I looked on the net.

Thanks for any piece of information.

回答1:

iOS uses scalable fonts, and you can specify the size in fractions of points. So there's no way to list the possibilities. Give the user a few good choices or a slider.



回答2:

Like David Dunham said, fonts are scalable, so you can use the [UIFont normalSystemFondOfSize:] method to access a font with any size. You can also use [UIFont fontWithName:size:] if you need to actually change the font used.