Search code examples
iosgestures

How to restrict PanGesture on subivews in ios


I have a view which is having pan gesture. i am adding date picker as subview to that view. when i pan on date picker that pan gesture is getting fired. Please help me.

Thanks in advance.


Solution

  • iOS 6 introduces a great new feature that solves this exact problem - a UIView (subview) can return NO from gestureRecognizerShouldBegin: (gesture recognizer attached to a superview). Indeed, that is the default for some UIView subclasses with regard to some gesture recognizers already (e.g. a UIButton with regard to a UITapGestureRecognizer attached to a superview).

    See matt's book on this topic: matt's book