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

查看:362
本文介绍了UIButton的标题标签单词包裹尾部截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

推荐答案

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

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.

这篇关于UIButton的标题标签单词包裹尾部截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆