如何在 iOS 7 上的 UINavigationController 中禁用向后滑动手势 [英] How to disable back swipe gesture in UINavigationController on iOS 7

查看:24
本文介绍了如何在 iOS 7 上的 UINavigationController 中禁用向后滑动手势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 iOS 7 中,Apple 添加了新的默认导航行为.您可以从屏幕的左边缘滑动以返回导航堆栈.但是在我的应用程序中,这种行为与我的自定义左侧菜单冲突.那么,是否可以在 UINavigationController 中禁用这个新手势?

In iOS 7 Apple added a new default navigation behavior. You can swipe from the left edge of the screen to go back on the navigation stack. But in my app, this behavior conflicts with my custom left menu. So, is it possible to disable this new gesture in UINavigationController?

推荐答案

我找到了解决方案:

目标-C:

if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
    self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}

Swift 3+:
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false

这篇关于如何在 iOS 7 上的 UINavigationController 中禁用向后滑动手势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆