UITextView has completed the selection of changes

I want to catch an event when the user completes the selection of changes in the UITextView. The method textViewDidChangeSelection:calls several times while the user drags the cursor. I try to use touchesEnded:withEvent:, but it does not call. Try adding a pan gesture, but the pan handler does not call.

+3
source share
3 answers

UITextInputDelegate selectionDidChange(_:)Called when the user has finished changing selections (lifts a finger from selection descriptors). On UITextViewset your class as inputDelegate. This works for read-only text views.

+2
source

, . .. selectedRange textViewDidChangeSelection: , selectedRange.length . , -, .

+4

I think you will have to subclass UITextViewand implement touchesEnded:withEvent:to find out when the user stops changing choices.

0
source

All Articles