iOS7 interactivePopGestureRecognizer for hidden navigation bar

November 30, 2013

iOS7 introduces interactivePopGestureRecognizer property which is used for popping current view controller stack by a gesture (swipe right gesture from left edge as default). However if the navigation bar is hidden or the app uses a custom back button for navigation bar, this feature will not work. A bit lines of code can make this feature works again for those cases. In viewDidLoad() of view controller (or application:didFinishLaunchingWithOptions: of AppDelegate), we set the interactivePopGestureRecognizer.delegate to nil as below:

if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
  self.navigationController.interactivePopGestureRecognizer.delegate = nil;
}

Discussion, links, and tweets