UINavigationContoller interactivePopGestureRecognizer 在导航栏隐藏时不活动 [英] UINavigationContoller interactivePopGestureRecognizer inactive when navigation bar is hidden

查看:18
本文介绍了UINavigationContoller interactivePopGestureRecognizer 在导航栏隐藏时不活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个嵌套在 UINavigationController 中的视图控制器.

I have a view controller which is nested within a UINavigationController.

我已经实现了 iOS 7 interactivePopGestureRecognizer 以使用户能够通过手势将 VC 从堆栈中弹出.

I have implemented the iOS 7 interactivePopGestureRecognizer to enable the user to gesture to pop a VC off the stack.

在 VC 中,我有一个滚动视图,当用户不在滚动视图的顶部时,我隐藏了所有 chrome(导航栏和状态栏)以将焦点放在内容上.

Within the VC i have a scrollview and whilst the user is not at the top of the scrollview I hide all the chrome (Navigation bar and status bar) to place focus on the content.

但是在隐藏导航栏的情况下,interactivePopGestureRecognizer 无法正常工作.

However with the navigation bar hidden, the interactivePopGestureRecognizer is not working.

我尝试在它消失后启用它并验证它不是 nil,但它仍然不起作用.

I have tried enabling it after it has disappeared and verified it is not nil, however it still doesn't work.

我有什么遗漏吗?

推荐答案

将你的 UIViewController 子类设置为 gestureRecognizer 的委托:

Set your UIViewController subclass as the gestureRecognizer's delegate:

self.navigationController.interactivePopGestureRecognizer.delegate = self;

就是这样!

这篇关于UINavigationContoller interactivePopGestureRecognizer 在导航栏隐藏时不活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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