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 末尾显示更多按钮


基础教程推荐
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01