【问题标题】:TTTAttributedLabel clickable link does not work in Swift 3TTTAttributedLabel 可点击链接在 Swift 3 中不起作用
【发布时间】:2016-10-20 08:58:23
【问题描述】:

我刚刚升级到 Swift 3。我创建了一个带有可点击 URL 的 TTTAttributedLabel,不幸的是,委托功能不再起作用。谁有类似的问题?

    func attributedLabel(_ label: TTTAttributedLabel!, didSelectLinkWith url: URL!) {
}

【问题讨论】:

    标签: uilabel swift3 tttattributedlabel


    【解决方案1】:

    你记得连接代理吗?

    label.delegate = 自我

    它对我有用

    【讨论】:

    • 是的,这就是问题所在。谢谢。
    【解决方案2】:
       extension YourViewController: TTTAttributedLabelDelegate {   
            func attributedLabel(_ label: TTTAttributedLabel!, didSelectLinkWith url: URL!) {
                UIApplication.shared.openURL(url)
            }
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-24
      • 2012-09-19
      • 1970-01-01
      相关资源
      最近更新 更多