开发者

How to hide the backbutton in uinavigationcontroller

开发者 https://www.devze.com 2023-03-27 04:35 出处:网络
I tried to remove the backbutton of uinavigationcontroller by using appdelegate.navigationController.navigationItem.hidesBackButton=YES;

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];

0

精彩评论

暂无评论...
验证码 换一张
取 消