UIButton的标题标签单词包裹尾部截断(UIButton's Title Label Word Wrap with Tail Truncation)

IPhone IT屋
百度翻译此文   有道翻译此文
问 题

I need to enable word wrapping and tail truncation, at the same time, on a UIButton's titleLabel. Setting numberOfLines to something more than 0 doesn't work, the text stays on one line.

I've already searched around and haven't found a solution. Any idea?

解决方案

I solved it the same day I posted this question by putting a UIButton on top of a UILabel with numberOfLines set to 3. I had left this unaccepted to see if someone had a better idea, but apparently there's no other solution.

本文地址:IT屋 » UIButton's Title Label Word Wrap with Tail Truncation

问 题

我需要同时启用自动换行和尾部截断 UIButton 的 titleLabel 。将numberOfLines设置为大于0的值不起作用,文本保持在一行。



我已经搜索过并且没有找到解决方案。有什么好主意吗?


解决方案

我在发布此问题的同一天解决了这个问题: UIButton 在 UILabel 之上, numberOfLines 设置为3.我离开了这个未被接受,看看是否有人有更好的想法,但显然没有其他解决方案。


本文地址:IT屋 » UIButton的标题标签单词包裹尾部截断

官方微信
扫一扫关注IT屋
微信公众号搜索 “ IT屋 ” ,选择关注
与百万开发者在一起