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 末尾显示更多按钮
基础教程推荐
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
