How to hide the "back" button in UINavigationController?

Zoran Simic picture Zoran Simic · Sep 21, 2009 · Viewed 84.6k times · Source

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.

Answer

Zoran Simic picture Zoran Simic · Sep 21, 2009

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)