SlideOutMenu remove Navigation Bar

主宰稳场 提交于 2019-12-12 03:56:12

问题


I use SWRevealViewController for my project. Currently, the problem is that when the project starts, Navigation bar show with title of "MyApp". But, navigation bar disappears when I click on Home

If I add a Navigation Bar in view controller, there will be 2 navigation bars at first run. One navigation will automatically disappear when I click on Home link.

How to do to get the first image appearance when I click on Home link? I'm using Swift 3.


回答1:


You could try set the navigation bar to not hidden in the viewWillAppear.

override func viewWillAppear(_ animated: Bool) {

    super.viewWillAppear(animated)

    navigationController?.setNavigationBarHidden(false, animated: false)

    // ...
}

However I presume the reason the navigation bar is hidden is because the controller is being presented modally and not being pushed onto the main navigation controller. If this is the case, then you will need to probably do something with the SWRevealViewController and push the controller onto the main navigation controller.

Check out the Basic API usage for SWRevealViewController here and here is an alternative that has codeless storyboard implementation and is very easy to configure.




回答2:


(Posted on behalf of the OP).

I'm not sure the way I solved is right or wrong. But, it works for me. I remove default Navigation Bar by disabling the bar visibility. Then, I add new Navigation Bar in Home page. After I run the app, my new Navigation Bar appears when I press on the Home button.



来源:https://stackoverflow.com/questions/42172297/slideoutmenu-remove-navigation-bar

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