iOS how to remove back button?
In swift
self.navigationItem.hidesBackButton = true
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.
The above code did not work for me. As suggested in UINavigationItem setHidesBackButton:YES won't prevent from going back, I had to use:
[self.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithCustomView:[[UIView alloc] init]]];
You can do:
[self.navigationItem setHidesBackButton:YES];
In your second view controller (the one you want to hide the button in).