How to hide the backbutton in uinavigationcontroller
I tried to remove the backbutton of uinavigationcontroller by using
appdelegate.navigationController.navigationItem.hidesBackButton=YES;
but it does not remove the backbutton after the pushing a new viewcontroller into navigation stack.How to hide th开发者_运维知识库is?
In the view controller's viewDidLoad method that you want to hide the back button:
self.navigationItem.hidesBackButton = YES;
Your above line is wrong. do it with :
self.navigationController.navigationItem.hidesBackButton = TRUE;
You can write this in your ViewDidLoad
as well as in ViewWillAppear
method:
self.navigationItem.hidesBackButton = YES;
The existing answers didn't work for me. I found that the best way for me was:
self.navigationItem.leftBarButtonItems = [NSArray array];
精彩评论