Swift

2020-02-25  本文已影响0人  rztime

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
    }
上一篇 下一篇

猜你喜欢

热点阅读