Search code examples
objective-cios8uinavigationcontrolleruinavigationitem

How to delete Navigation Bar Button Item


I am pushing ViewController programmatically using this code:

 LoginInfoVC *nextScr = (LoginInfoVC *) [self.storyboard instantiateViewControllerWithIdentifier:@"LoginInfoVC"];
 [self.navigationController pushViewController:nextScr animated:YES];

And in my LoginInfoVC didLoad Method I am using this code to remove back button but its not working:

 self.navigationItem.leftBarButtonItem = nil;

I also used this code:

 self.navigationItem.leftBarButtonItem.enabled = NO;

I also followed this but it doesn't help me.


Solution

  • Use this

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