benhi benhi - 5 months ago 32
iOS Question

Forward event touch with two fingers on UITextView

I need to apply a function when the user touches the screen with two fingers.
My problem that is the screen has a


There is also active keyboard present on the screen, that's why the usual approach (
) doesn't work for this configuration.

How can I do this?



Since you can't subclass UIKeyboard to 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 the UITextField area (and handle them properly) or send them down to responder chain.

Not as elegant as using gesture recognisers but you could make it work.