后退按钮未显示在 UINavigationController 上

发布于 2024-10-16 22:43:19 字数 320 浏览 2 评论 0原文

我有3个观点。第一个是登录,第二个是菜单,第三个是菜单各部分的结果。我希望当用户登录时,后退按钮不会出现在第二个视图中。这部分有效,但是当我浏览第三个视图时,它也被隐藏了。我创建了第四个视图,当我输入时,会出现后退按钮,它让我返回到第二个视图。

为了隐藏后退按钮,我仅在第二个视图中设置了此按钮:

- (void)viewDidLoad {
    self.navigationItem.hidesBackButton = YES;
}

我也尝试在第三个视图中设置相反的按钮,但它没有显示。

为什么它没有显示在第三个视图上?

I have 3 views. The first is a login, the second is a menu, and the third is the result of each part of the menu. I want that when the user logs in, the back button won't appear in the second view. This part works but when I go through the third view, it is hidden too. I've created a fourth view and when I enter, the back button appears and it lets me go back until the second view.

For hiding the back button, I've set this only in the second view:

- (void)viewDidLoad {
    self.navigationItem.hidesBackButton = YES;
}

I've also tried to set the opposite in the third view and it don't show.

Why it is not showing on the third view?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

海的爱人是光 2024-10-23 22:43:19

在第二个ViewController中执行此操作(在登录之后)

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    self.navigationItem.hidesBackButton = NO;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.navigationItem.hidesBackButton = YES;
}

do this in secondViewController(after the login one)

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    self.navigationItem.hidesBackButton = NO;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.navigationItem.hidesBackButton = YES;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文