在 iOS 7 中,Apple 添加了新的默认导航行为。您可以从屏幕的左边缘滑动以返回导航堆栈。但在我的应用程序中,这种行为与我的自定义左侧菜单冲突。那么,是否可以在 UINavigationController 中禁用这个新手势?
最佳答案
我找到了解决办法:
objective-C :
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
Swift 3+:
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false
关于ios - 如何在 iOS 7 上的 UINavigationController 中禁用向后滑动手势,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17209468/