Saturday 13 April 2013

iOS: Adding UIGestureRecognizer causes subview not responding to touches

If you have an UIView which contains some subview such as buttons, adding UIGestureRecognizer will cause these subviews not responding to touches. The reason is by default the gesture recognizer handles all touches and discard them, therefore the subviews do not receive any touch.

The fix is adding


    recognizer.cancelsTouchesInView = NO;

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIGestureRecognizer_Class/Reference/Reference.html

No comments:

Post a Comment