I need to apply a function when the user touches the screen with two fingers.
My problem that is the screen has a UITextView.
There is also active keyboard present on the screen, that’s why the usual approach (UITapGestureRecognizer) doesn’t work for this configuration.
How can I do this?
Thanks.
Since you can’t subclass
UIKeyboardto pass touches maybe this link will help you.Detect if the user has touched the screen
There’s a subclass of
UIWindow– if you set it as your main application window (in appDelegate) you might catch touches before they get to keyboard. There you should be able to check if touches are in theUITextFieldarea (and handle them properly) or send them down to responder chain.Not as elegant as using gesture recognisers but you could make it work.