根据UILabel的框架大小设置字体大小?
我有一个应用程序,允许用户使用捏合手势来缩放标签 如何根据新的框架大小更改字体大小,使字体恰好适合框架矩形?
我当前的步骤只是使用新的变换设置标签,如果标签缩放得太小/太大,文本将看起来模糊。 我想确保标签可以清楚地显示文本,其中文本可以根据新的框架矩形具有最大尺寸。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 InterfaceBuilder,请选中标签的“自动收缩”。
确保“最小尺寸”不要太大。
If you're using InterfaceBuilder, check "Autoshrink" for the label.
Make sure that "Minimum Size" is not too large.