iOS:带有“显示更多"的 UILabel按钮 [英] iOS: UILabel with a "Show more" button
问题描述
我在 UILabel 中有一个文本主干
I have a trunk of text in an UILabel
Lorem ipsum dolor 坐 amet,consectetur adipiscing 精英.Vestibulum eget tortor porttitor、aliquam magna bibendum...显示更多
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eget tortor porttitor, aliquam magna bibendum...show more
当我点击显示更多"时,它应该展开
When I click on "show more", it should expand
Lorem ipsum dolor 坐 amet,consectetur adipiscing 精英.Vestibulum eget Tortor porttitor、aliquam magna bibendum、venenatis nunc.Aenean commodo nisl vel semper blandit.Vivamus rhoncus、lorem sed mollis tristique、dolor velit moestie ligula、eget semper leo augue eu urna.显示更少
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eget tortor porttitor, aliquam magna bibendum, venenatis nunc. Aenean commodo nisl vel semper blandit. Vivamus rhoncus, lorem sed mollis tristique, dolor velit molestie ligula, eget semper leo augue eu urna. show less
我该如何实施?
推荐答案
您可以尝试使用 TTTAttributedLabel 和 truncationTokenString 添加更多显示,添加更少显示可以使用来自 TTTAttributedLabel 的链接
You can try TTTAttributedLabel and truncationTokenString to add show more, for adding show less you can use links from TTTAttributedLabel
可能重复 UILabel 中的更多按钮,如AppStore 任何应用描述
这篇关于iOS:带有“显示更多"的 UILabel按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!