设置 navigationController.hidesBarsOnSwipe = YES 不再显示我的导航栏 [英] Setting navigationController.hidesBarsOnSwipe = YES never shows my navbar again

查看:11
本文介绍了设置 navigationController.hidesBarsOnSwipe = YES 不再显示我的导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我设置 navigationController.hidesBarOnSwipe = YES 并尝试在 webView 中滑动时显示导航栏已隐藏,但当我尝试滑动以将其取回时,它将永远不会再次出现.p>

我的 ViewController 正在监听滑动事件:

[self.navigationController.barHideOnSwipeGestureRecognizer addTarget:self action:@selector(swipe:)]?

但事实上,在导航栏因为 Swipe 而隐藏之后,这个选择器就再也不会被调用了.有人实现了 hidesBarOnSwipe 吗?它是一个已知的错误还是按照设计它隐藏后不会显示导航栏.

之前:

之后:

解决方案

我的 UIWebView 也有同样的问题,通过将 WebView 的约束更新为相对于超级视图而不是布局指南:

When i set navigationController.hidesBarOnSwipe = YES and try swiping in the webView shown the navigation bar is hidden, but it will never show up again, when i try swiping to get it back.

My ViewController is listening to the swipe event :

[self.navigationController.barHideOnSwipeGestureRecognizer addTarget:self action:@selector(swipe:)]?

But this selector is in fact never called again after the navigation bar is hidden because of the Swipe. Anyone implemented hidesBarOnSwipe? Is it a known bug or is it as designed that it won't show the navigation bar after hiding it.

Before:

After:

解决方案

I have the same problem with my UIWebView, It's fixed by updating the constrains of my WebView to be relative to the superview not layout guide:

这篇关于设置 navigationController.hidesBarsOnSwipe = YES 不再显示我的导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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