Reputation: 18406
Despite the accepted answer, I'm still hoping for a more detailed one, with examples.
I got many views and I just want to, wherever the user is, gather the touch input on the screen.
How can we, despite the warnings, detect the touch from any class without worrying about other views?
edit: I've tried using touchesBegan
on the front most view (which is working fine) and [super touchesBegan ...]
or [self.nextResponder ...]
but that didn't trigger it from the main class.
I also tried using UIImage
from the back view with no success. Lastly I though of using some alert, but I'm not sure if it's possible to tweak it as to make it invisible, so I decided asking first what's the best way.
Specially good if it's iOS3 compatible.
Upvotes: 0
Views: 2673
Reputation: 3572
Are you trying to support an old iPhone OS version and thus stuck with -touchesBegan, -touchesMoved, etc?
If not, I suggest you use UIGestureRecognizers instead. You wont have to worry about other views that way. The view that gets the touch will get it's gesture recognizer executed, no need to worry about hit testing.
Upvotes: 3