Pregunta

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.

¿Fue útil?

Solución

myLabel.adjustsFontSizeToFitWidth = YES;

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

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top