开发者

iOS - Resize UILabel to match content?

开发者 https://www.devze.com 2023-03-25 00:39 出处:网络
I have a UILabel with linecount of 0. I set the text for this UILabel in code. How can I make the UILable to resize itself until it displays the full content?

I have a UILabel with linecount of 0. I set the text for this UILabel in code. How can I make the UILable to resize itself until it displays the full content? I don't want to take any space unless开发者_如何转开发 the text is long enough to be displayed in multiple lines.


You may be looking for [label sizeToFit]; That will get your label to crop tight on the text you give it.

0

精彩评论

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