Back Button in UINavigationBar Hide Problem

jylee picture jylee · Aug 5, 2011 · Viewed 11.6k times · Source

When I use this: [self.navigationItem setHidesBackButton:YES animated:NO]; to hide the back button in my navigationBar, my title doesn't get centered. It prints like the button is still there.

does anyone know why this happens, and how to fix it?

EDIT:

My program is like so: my rootViewController is a navigation controller, and I set that so the navigation bar is hidden. Then I push to another UIViewController, which I make the navigation bar appear again, but make the back button disappear.

I tried the setting self.navigationItem.backBarButtonItem = nil;, but it didn't make the backbutton disappear.

Here's some pictures for reference:

Picture with back button Picture without

Answer

Fourj picture Fourj · Nov 16, 2011
viewController.navigationItem.hidesBackButton = YES;

This works perfectly!