How to hide the "back" button in UINavigationController?

Do you know how to hide the 'back' button in a UINavigationController? Also, how to show it back, but I guess that's very similar to hiding it...

Just like the mail application does on the iPhone when you hit 'Edit' while viewing emails.


Solution 1:

I just found out the answer, in a controller use this:

[self.navigationItem setHidesBackButton:YES animated:YES];

And to restore it:

[self.navigationItem setHidesBackButton:NO animated:YES];

--

[UPDATE]

Swift 3.0:

self.navigationItem.setHidesBackButton(true, animated:true)

Solution 2:

Add this Code

[self.navigationItem setHidesBackButton:YES];