本文介绍了显示文本结尾旁边的更多按钮Swift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果没有足够的空间,我想在文本末尾或下方显示更多按钮。我不明白Apple开发者是怎么做到的?
请快速回答。点击更多按钮后我想显示所有文字。将按钮更改为更少。
I want to show more button at the end of the text or below if there isn't enough space. I don't understand how Apple developers did this?Please answer in swift. After clicking on more button i want to show all the text. change the button to less.
提前致谢。
推荐答案
这里有一个很棒的CocoaPod,可用于您正在寻找的功能。
Here's a great CocoaPod for the functionality you're looking for.
这将允许您设置最大行数并自定义附加到修剪文本末尾的文本。您可以更改字体和颜色,因为它是 NSAttributedString
。
This will allow you to set a maximum number of lines and customise the text append to the end of the trimmed text. You can change the font and color since it is an NSAttributedString
.
这篇关于显示文本结尾旁边的更多按钮Swift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!