iOS how to remove back button?

jbearden picture jbearden · Feb 29, 2012 · Viewed 28.4k times · Source

I have an application with a navigation bar that pushes to a login screen view controller and then pushes to a main menu. Is there any way I can remove the back button off the main menu, so the user is unable to go back to the login screen?

Thanks!

EDIT: Using Xcode 4.3 and doing all the leg work programmatically.

Answer

Peter Sarnowski picture Peter Sarnowski · Feb 29, 2012

You can do:

[self.navigationItem setHidesBackButton:YES];

In your second view controller (the one you want to hide the button in).