質問

I have an application that allow user to use the pinch gesture for scaling the label How can I change the font size according to the new frame size so that the font just fit in the frame rectangle?

My current step is only set the label with new transform, and the text will look blur if the label is scaled too small/large. I want to ensure that the label can display the text clearly where the text can have the max size according to the new frame rectangle.

役に立ちましたか?

解決

myLabel.adjustsFontSizeToFitWidth = YES;

If you're using InterfaceBuilder, check "Autoshrink" for the label.

Make sure that "Minimum Size" is not too large.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top