Show more button next to end of text Swift(在文本 Swift 末尾显示更多按钮)
问题描述
如果空间不足,我想在文本末尾或下方显示更多按钮.我不明白苹果开发者是怎么做到的?请迅速回答.单击更多按钮后,我想显示所有文本.将按钮更改为更少.
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.
https://github.com/ilyapuchka/ReadMoreTextView
这将允许您设置最大行数并自定义附加到修剪文本末尾的文本.您可以更改字体和颜色,因为它是 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 末尾显示更多按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在文本 Swift 末尾显示更多按钮


- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- UITextView 内容插图 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- URL编码Swift iOS 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01