Christopher Shireman
Christopher Shireman

Reputation: 98

ios5 remove back button

I am trying to remove the back button from the navigation bar for my current view. The current view is pushed onto the stack as part of the app startup animation (I inherited this app, I would never do such a thing). The problem is that in iOS 5 the back button is now showing. This wasn't a problem iOS 4.3 because the UINavigationBar's drawRect was overridden with a category to create a custom background image. I have updated the code to use the new iOS5 setBackgroundImage:forBarMetrics selector, and now the back button shows.

I have already tried to use this:

[[self navigationItem] setBackBarButtonItem:nil];

and this:

[[self navigationItem] setLeftBarButtonItem:nil];

But neither seems to work, any help would be greatly appreciated.

Upvotes: 1

Views: 1410

Answers (1)

Shumais Ul Haq
Shumais Ul Haq

Reputation: 1447

For everyones benefit:

Use this line : self.navigationItem.hidesBackButton = YES;

Best of luck.

Upvotes: 5

Related Questions