Cannot safely subclass UIPanGestureRecognizer
| Originator: | chinmaygarde | ||
| Number: | rdar://15419007 | Date Originated: | 07-Nov-2013 03:24 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 7 |
| Classification: | Other Bug | Reproducible: | Always |
Summary: Any subclass of a UIPanGestureRecognizer that calls -[UIPanGestureRecognizer ignoreTouch:forEvent:] makes the recognizer be stuck in an inconsistent state Steps to Reproduce: * Create a custom UIPanGestureRecognizer subclass. * Override only [UIGestureRecognizer touchesMoved:withEvent:]. After calling the method on super, ignore any touch. * Create an instance of the gesture recognizer with minimumNumberOfTouches set to 2. * Observe the state changes in the action method. I have attached a sample project. Un/comment out line 24 in ViewController.m and observe logs while performing a pan with 2 touches. Expected Results: * Since a touch is being ignored, the recognizer should move to the UIGestureRecognizerStateFailed and subsequently be reset. This is because the recognizer is no longer getting the minimum number of touches. * The recognizer should not react to tap or pinch gestures * The numberOfTouches should not keep increasing Actual Results: * The recognizer is stuck in UIGestureRecognizerStateChanged * The recognizer calls the action method for tap and pinch gestures as well * Calling numberOfTouches when the incorrect action method is called results in the a large number of touches returned (all of them not part of recognition)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!