In my class I have 11 UITapGestureRecognizers in an array textViewRecognizer attached to 11 out of 100 UITextFields in an array boxArray. When a Textfield is tapped containing a
It sounds like you want to remove the automatic editing behavior on a UITextView
. You can grab more control over that with the textViewShouldBeginEditing(_ textView: UITextView) -> Bool
UITextViewDelegate
method, documented here.
If you return false
for that method, this should avoid needing a double tap to get to your gesture recognizer. Depending on your use case, you can then "allow" the tap to go to the text view by returning true
for the textView you want to be actually edited.
While I'm not 100% clear on the first responder part of your question, since the textView won't be grabbing first responder if it's not starting it's editing mode, this should address that concern I believe. Good luck!
I would add a Tag
to my UITextView
and set the UITextViewDelegate
to my ViewController
.
Then I would add the following Delegate method:
func textViewShouldBeginEditing(_ textView: UITextView) -> Bool {
print("Textview tag: ", textView.tag)
return false
}