在iOS7中,苹果增加了一个新的默认导航行为.您可以从屏幕的左边缘滑动以返回导航堆栈.但在我的应用程序中,这一行为与我的自定义左菜单冲突.那么,是否可以在UINavigationController中禁用这一新手势呢?
在iOS7中,苹果增加了一个新的默认导航行为.您可以从屏幕的左边缘滑动以返回导航堆栈.但在我的应用程序中,这一行为与我的自定义左菜单冲突.那么,是否可以在UINavigationController中禁用这一新手势呢?
我找到了一个解决方案:
Objective-C:
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
Swift 3+:
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false