Detecting taps on attributed text in a UITextView while the keyboard is showing

前端 未结 1 1062
北恋
北恋 2021-02-09 03:54

This is a supplemental question to a previous answer of mine to the question Detecting taps on attributed text in a UITextView in iOS.

I retested the following code with

相关标签:
1条回答
  • 2021-02-09 04:02

    In your UITextView's controller,you can implement UITextViewDelegate , Then override method

    -(BOOL)textViewShouldBeginEditing:(UITextView *)textView{
    }
    

    Inside this method you can access the textView's selectedRange,which should also be the "tap range" of your attributed text. Then return true / false depending on your needs.

    0 讨论(0)
提交回复
热议问题