Does iOS 7/8 support tracking after user's gestures and taps across the entire app, without the need to literally listen on every view?
Yes you can achieve this by attaching a gesture recognizer to your UIWindow in your AppDelegate
. UIWindow
is a subclass of UIView
, and because it manages your views anyway you can attach a gesture recognizer here.
Conform to UIGestureRecognizerDelegate
in your AppDelegate
, attach whatever gesture recognizer you want to your UIWindow
instance (of course set the delegate as well), and override the following:
func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool {
//do whatever with your touch
return false;
}
Returning false is important, so that your code won't interfere with your regular app function; but it is important to note that because you have to return false, in order for this to work you must do all your UITouch work in the location as noted above.