简体   繁体   English

调整字体大小以适合边框矩形吗?

[英]Adjust Font Size to Fit Bounding Rect?

I have a UILabel which has a defined frame: 我有一个UILabel有一个定义的框架:

let label = UILabel(frame: someFrame)

Is it possible that the font size will be adjusted to fit the height of the bounding Rect or fit the height and width of the bounding rect? 是否可能会调整字体大小以适合边界Rect的高度或适合边界rect的高度和宽度?

Set the label's font size to something absurdly large, then set the label's autoshrink to an absurdly small minimum font size. 将标签的字体大小设置为大得惊人,然后将标签的自动收缩率设置为最小的最小字体。 Now your label's font will always fit it's frame. 现在,标签的字体将始终适合其框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM