简体   繁体   中英

navigation bar states, showing and hiding the bottom nav bar

Keep in mind with the following question, I am still an iOS noob.

So I understand how to hide/show/recolor the navigation bar and whatnot. My next challenge is that some screens need the nav bar and others do not.

When my app starts off, I have the nav bar as hidden and then the user can click register or log in (both of which screens have a nav bar).

So those screens have the code to show the nav bar all while the first (welcome screen) has the code to hide the nav bar.

Here is the question: Why is it that when I first start my app, the nav bar is not there, but when I go to register/login and then hit the back button to return to the welcome page (initial page) then the nav bar is still there, even though my code to hide it is in the viewDidLoad method? How can I fix this?

You can try moving the logic of hidding the Nav bar to the ViewWillAppear method, you just need to override it in your View Controller class.

Alternatively I would suggest to use a separate view controller to handle your login/registration screens and only use nav bars where you need them. You would have to create a view controller in your story board with your regular screens and embed the screens that need the tab bar in a navigation controller, You can then segue from your regular view controller into the navigation controller that includes your tabs.

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM