UIScreenEdgePanGestureRecognizer + custom leftBarButtonItem + UICollectionView = impossible

Originator:info
Number:rdar://15119337 Date Originated:01-Oct-2013 10:26 AM
Status:Open Resolved:
Product:iOS SDK Product Version:7
Classification:UI/Usability Reproducible:Always
 
Summary:
In iOS 7 the navigation controller has a UIScreenEdgePanGestureRecognizer, swiping from the left of the screen pops the current view controller. Very nice.

However, using a custom leftBarButtonItem breaks this functionality:

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Custom" style:UIBarButtonItemStylePlain target:self action:@selector(back)];

One simple fix is to include this code as well:

self.navigationController.interactivePopGestureRecognizer.delegate = self;

This works fine, except when you include an UICollectionView (or use an UICollectionViewController). It seems like it's impossible to have a working combination of collection view, custom leftBarButtonItem and the screen edge pan gesture.

Steps to Reproduce:
1. Create a stack of UINavigationController, UIViewController and push a UIViewController.

2. See that the UIScreenEdgePanGestureRecognizer works as expected.

3. Set a custom left bar button on the child controller:
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Custom" style:UIBarButtonItemStylePlain target:self action:@selector(back)];

4. See that the UIScreenEdgePanGestureRecognizer no longer works.

5. Include this fix:
self.navigationController.interactivePopGestureRecognizer.delegate = self;

6. See that the UIScreenEdgePanGestureRecognizer again works as expected.

7. Now add a UICollectionView to the child view controller

8. See that the UIScreenEdgePanGestureRecognizer no longer works.

Expected Results:
The UIScreenEdgePanGestureRecognizer should still work.

Actual Results:
It doesn't and the interactivePopGestureRecognizer.delegate doesn't work.

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!