self.navigationController.interactivePopGestureRecognizer.en
发布时间:2020-12-14 17:23:11 所属栏目:百科 来源:网络整理
导读:我想在滑动视图控制器时禁用弹出手势,但下面的行在iOS 8中不起作用: self.navigationController.interactivePopGestureRecognizer.enabled = NO; 提前致谢 解决方法 在您希望禁用它的viewcontroller中,添加以下行: - (void)viewDidAppear:(BOOL)animated{
我想在滑动视图控制器时禁用弹出手势,但下面的行在iOS 8中不起作用:
self.navigationController.interactivePopGestureRecognizer.enabled = NO; 提前致谢 解决方法
在您希望禁用它的viewcontroller中,添加以下行:
- (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecognizer.delegate = self; } } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecognizer.delegate = nil; } } - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { return NO; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |