我有一个应用程序,允许用户使用缩放手势来缩放标签如何根据新的框架大小更改字体大小,以便字体适合框架矩形?
我目前的步骤只是使用新转换设置标签,并且如果标签太小/太大,文本将显得模糊。 我想确保标签可以根据新的框架矩形清楚地显示文本的最大尺寸。
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;如果您使用的是InterfaceBuilder,请检查标签的“Autoshrink”。
确保“最小尺寸”不是太大。
myLabel.adjustsFontSizeToFitWidth = YES;If you're using InterfaceBuilder, check "Autoshrink" for the label.
Make sure that "Minimum Size" is not too large.
更多推荐
发布评论