• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

UILabel的更多按钮,如AppStore的任何应用说明

用户头像
it1352
帮助1

问题说明

我有myObject的描述,我在UILabel中显示它。如果描述太长,我想在我的 UILabel 中添加更多按钮。在Github上我找到了 TTTAttributedLabel ,它允许使用超链接。问题是, UILabel UITextView 中是否有一些特殊功能可以解决我的问题,或者我必须使用 TTTAttributedLabel

I have a description of myObject and i show it in UILabel. I want to add 'More' button to my UILabel if a description is too long. On Github i have found TTTAttributedLabel which allows to use hyperlinks. The question is, is there some special features in UILabel or UITextView to resolve my issue or i have to use TTTAttributedLabel?

正确答案

#1

最好的选择肯定是使用 TTTAttributedLabel

The best option is certainly to use TTTAttributedLabel.

UILabel UITextView 仅用于显示静态文本。没有添加可点击元素的方法。

UILabel and UITextView are designed simply for showing static text. There is no method for adding tappable elements.

作为替代方案,在我倾向于 TTTAttributedLabel 之前我只是放了一个 UIButton 在我的 UILabel 上使用自定义样式。按钮是看不见的,但仍然响应水龙头(领头)(领头)。这对于静态文本最有效,因为按钮需要正确放置在界面上以覆盖文本的正确部分。

As an alternative, before I leaned of TTTAttributedLabel I simply placed a UIButton with a custom style over my UILabel. The button was invisible but still responded to taps. This works best for static text though, as the button needs to be placed correctly on the interface to cover the correct part of the text.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfiebf
系列文章
更多 icon
同类精品
更多 icon
继续加载