Swift

作者: rztime | 来源:发表于2020-02-25 17:34 被阅读0次

Ambiguous use of 'textView(_:shouldInteractWith:in:interaction:)'

解决方案

    @available(iOS 10.0, *)
    func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
        if tagert == nil {
            return true
        }
        if tagert!.responds(to: (#selector(textView(_:shouldInteractWith:in:interaction:) as (UITextView, URL, NSRange, UITextItemInteraction) -> Bool))){
            return tagert!.textView(textView, shouldInteractWith: URL, in: characterRange, interaction: interaction)
        }
        return true
    }
    
    @available(iOS 10.0, *)
    func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
        if tagert == nil {
            return true
        }
        if tagert!.responds(to: #selector(textView(_:shouldInteractWith:in:interaction:)as (UITextView, NSTextAttachment, NSRange, UITextItemInteraction) -> Bool)){
            return tagert!.textView(textView, shouldInteractWith: textAttachment, in: characterRange, interaction: interaction)
        }
        return true
    }

相关文章

网友评论

      本文标题:Swift

      本文链接:https://www.haomeiwen.com/subject/cwbxchtx.html