iOS how to remove back button? iOS how to remove back button? ios ios

iOS how to remove back button?


You can do:

[self.navigationItem setHidesBackButton:YES];

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


Peters answer is correct, although I think the better question is why? In a schema like yours where you are wanting to login a user, instead of using a Pushed VC, present a Modal VC and use a delegate method to get back the userinfo that was obtained in the Login process. I can post a complete code example if you need it, but it sounds like you have the details worked out with your login process. Just use:

presentModalViewController

instead of:

pushViewController

That way, you don't have to worry about the navigation stack and doing something that isn't really in-line with the user interface guidelines.


In swift

self.navigationItem.hidesBackButton = true