I have a message chat box similar to most chat apps. The box goes up when when you start editing the messagetextView.
As is standard, there is a tap gesture recognizer that is called when the user taps anywhere else, which dismisses the keyboard.
I have another button that is visible next to the chat box.
Currently when the user taps the button, instead of triggering that ibaction, it dismisses the keyboard. Then when they tap on it again the ibaction is called. So the user has to tap twice to trigger the button when the keyboard is up.
Is there a way configure the button or gesture recognizer so that they both get called when the user taps in that location?
- alternatively, is there a better design solution to solve something like this?
- note: I read that in this situation ios will either choose the responder tree or gesture recognizer tree. So perhaps traversing both. How?
There are several ways to solve this problem.
It seems like the view your add tap gesture is above the button.
Set tapGesture's delegate and implement the UIGestureRecognizerDelegate.
Disable the tap gesture when tap the button.
Or just set the tapGesture's view below the button.