James Lloyd
James Lloyd

Reputation: 339

How to prevent following view controller inheriting navigation view controller bar?

My app starts off with a navigation controller then, using segues, continues onto two view controllers followed by a tab bar controller.

The problem is that the tab bar controller still inherits the navigation bar at the top, and displays the back button. I don't want the user to be able to click the back button, but rather use a click a separate log-out button to return to the beginning.

Essentially, how can the views following the tab bar controller un-inherit the navigation bar?

Upvotes: 1

Views: 248

Answers (2)

Fisky
Fisky

Reputation: 134

if incase , user can not come back to previous page unless logout after user goes to tabbar controller then better change root view controller of window .

if both are two different flow better handle with two navigation controller . example : signup / login flow and actual business flow . go with two different navigation controllers

Upvotes: 0

Shehata Gamal
Shehata Gamal

Reputation: 100533

You can do

self.navigationController?.isNavigationBarHidden = true

but it's not the right way to go , if the previous flow of vcs are not needed any more after the tab is presented you need to remove/clear ( for many reasons like improving performance in freeing memory of un needed vcs ) , by assigning

(UIApplication.shared.delegate as! AppDelegate).window!.rootViewController = tabBar

instead of presenting/pushing it

Upvotes: 2

Related Questions