在UINavigationController中隐藏导航栏时没有向后滑动 [英] No Swipe Back when hiding Navigation Bar in UINavigationController
问题描述
我喜欢通过在UINavigationController中嵌入视图而继承的滑动包。不幸的是,我似乎找不到隐藏导航栏的方法,但仍然有触摸平移向后滑动手势。我可以编写自定义手势,但我不喜欢和依赖UINavigationController反向滑动手势。
I love the swipe pack thats inherited from embedding your views in a UINavigationController. Unfortunately i cannot seem to find a way to hide the navigation bar but still have the touch pan swipe back gesture. I can write custom gestures but I prefer not to and to rely on the UINavigationController back swipe gesture instead.
如果我在故事板中取消选中它,后面的滑动不会工作
if I uncheck it in the storyboard, the back swipe doesn't work
或者,如果我以编程方式隐藏它,则相同的情况。
alternatively if I programmatically hide it, the same scenario.
- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController setNavigationBarHidden:YES animated:NO]; // and animated:YES
}
有无法隐藏顶部导航栏仍然有滑动?
Is there no way to hide the top Navigation bar and still have the swipe?
推荐答案
正在运行的黑客是设置 interactivePopGestureRecognizer
将 UINavigationController
委托给 nil
,如下所示:
A hack that is working is to set the interactivePopGestureRecognizer
's delegate of the UINavigationController
to nil
like this:
[self.navigationController.interactivePopGestureRecognizer setDelegate:nil];
但在某些情况下,它可能会产生奇怪的效果。
But in some situations it could create strange effects.
这篇关于在UINavigationController中隐藏导航栏时没有向后滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!