Enforcement of 1:1 Gesture Recognizer-View fails to keep gesture recognizer attached to first view if multiple views are the same view
| Originator: | alex.botkin | ||
| Number: | rdar://31377291 | Date Originated: | 3/31/17 |
| Status: | Open | Resolved: | |
| Product: | iOS + SDK | Product Version: | 10.3 |
| Classification: | Serious Bug | Reproducible: | Always |
In the UIKit Dynamics Catalog source code example provided by Apple on its site, Main.storyboard has the pan gesture recognizer of the APLAttachmentsViewController connected to the controller's view three times in Interface Builder. It appears that when UIKit attempts to enforce the 1:1 relationship of gesture recognizer to view from iOS 9 and up, it does not check that the views it is removing the gesture recognizer from are the same as the first view and so ends up leading to the gesture recognizer not being attached to the view at all if added to that same view multiple times. 1. Download the UIKit Dynamics Catalog project 2. Run the project on iPhone 6 Simulator (10.3 / 14E269) 3. Select the Attachments + Collision example 4. Attempt to drag anywhere to move the square as prompted. This can also be reproduced on device. Looking further it appears, the gesture recognizer will still know the view it should be attached to, but the view itself has no knowledge of the gesture recognizer as shown by this LLDB done when the UIPanGestureRecognizer is hooked up to a new property called panGesture. (lldb) po self.panGesture <UIPanGestureRecognizer: 0x7fbacb60a700; state = Possible; view = <APLDecorationView 0x7fbacb41d970>; target= <(action=handleAttachmentGesture:, target=<APLAttachmentsViewController 0x7fbacb62d610>)>> (lldb) po self.view <APLDecorationView: 0x7fbacb41d970; frame = (0 0; 320 568); layer = <CALayer: 0x61000003c0e0>> (lldb) po self.view.gestureRecognizers <__NSArray0 0x6080000090a0>( ) (lldb) po self.panGesture.view <APLDecorationView: 0x7fbacb41d970; frame = (0 0; 320 568); layer = <CALayer: 0x61000003c0e0>>
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!