Setting navigationController.hidesBarsOnSwipe = YES never shows my navbar again

◇◆丶佛笑我妖孽 提交于 2019-12-18 19:18:12

问题


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:


回答1:


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:




回答2:


I had a similar problem where the navigation bar did not show even after I set the hidesBarOnSwipe to NO. Adding the following line fixed it for me (after setting hidesBarOnSwipe to NO)

[[self navigationController] setNavigationBarHidden:NO animated:YES];


来源:https://stackoverflow.com/questions/26524395/setting-navigationcontroller-hidesbarsonswipe-yes-never-shows-my-navbar-again

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!