简体   繁体   English

无法隐藏导航栏内的后退按钮

[英]Can't hide back button inside my navigationbar

I am trying to hide my backbutton in the firstView after I logged into the application. 我在登录应用程序后试图在firstView中隐藏我的后退按钮。 I have this piece of code inside my ViewWillAppear. 我在ViewWillAppear中有这段代码。

self.navigationController.navigationItem.hidesBackButton = YES;
self.navigationController.navigationBar.hidden = NO;

But my back button will not dissapear. 但我的后退按钮不会消失。

any help ? 任何帮助?

Kind regards. 亲切的问候。

改用它

self.navigationItem.hidesBackButton = YES;

Try these couple of lines , this will work out: 尝试这几行,这将解决:

self.navigationItem.hidesBackButton = TRUE;
self.navigationItem.leftBarButtonItem = nil;

You can set a custom UIBarButtonItem as left bar button. 您可以将自定义UIBarButtonItem设置为左栏按钮。 That one you can try to hide or desing in a smooth way that it helps achieving what you want to do. 那个你可以尝试以平滑的方式隐藏或设计它有助于实现你想要做的事情。

If you want to hide back button, than maybe you do not want to get back to previous screen. 如果你想隐藏后退按钮,可能你不想回到以前的屏幕。 If this is the case, instead of pushing navigation controller show your view modally. 如果是这种情况,而不是推动导航控制器以模态方式显示您的视图。 Otherwise do the following: 否则请执行以下操作:

UIButton* myButton=[UIButton buttonWithType:UIButtonTypeRoundedRect];
UIBarButtonItem* myBarButton=[[UIBarButtonItem alloc] initWithCustomView:myButton];
myButton.hidden = YES;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM