开发者

iPhone -- getting the adjusted font size of a UITextField

开发者 https://www.devze.com 2023-01-08 11:32 出处:网络
I have a UITextField with the adjustsFontSizeToFitWidth property set to YES.I want to get ahold of the current (adjusted) font size.Is that possible?

I have a UITextField with the adjustsFontSizeToFitWidth property set to YES. I want to get ahold of the current (adjusted) font size. Is that possible?

If not, getting ahold of the actual width of the text (in the adjusted size) would be almost as g开发者_高级运维ood.


In the adjusted size, the width of the text would be the same as the width of the text field.


I don't think it's possible, but it should not be too difficult to write your own class.


Here's a small snippet/extension I wrote down to handle this.

http://swiftstub.com/134886004/

0

精彩评论

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