开发者

Scaling UILabel text with the parent view

开发者 https://www.devze.com 2023-01-11 20:06 出处:网络
I have a UILabel that is a subview of a larger UIView. Is there a way to keep the 开发者_运维知识库text inside the UILabel proportional to the parent UIView so that when the parent changes size, eithe

I have a UILabel that is a subview of a larger UIView. Is there a way to keep the 开发者_运维知识库text inside the UILabel proportional to the parent UIView so that when the parent changes size, either smaller or larger, the font size for the text in the UILabel will grow and shrink proportionally?


I think there is no easy way but to calculate how much the parent view went bigger or smaller and taking that quantity making the font smaller or larger. For example if the parent view is smaller by 50 pixels wide then making the font 5 pts smaller. Hope it's helpful

0

精彩评论

暂无评论...
验证码 换一张
取 消