gpt4 book ai didi

iphone - 如何隐藏 UINavigationController 的后退按钮?

转载 作者:可可西里 更新时间:2023-11-01 05:37:46 25 4
gpt4 key购买 nike

我尝试了多种方法来隐藏我的 UINavigationController

的后退按钮
UINavigationController RVC = new UINavigationController();
other code
RVC.NavigationItem.SetHidesBackButton(true,true);

和其他类似的方式,但它们都没有真正隐藏后退按钮。有谁知道我做错了什么?

最佳答案

在 Controller 中使用 this.NavigationItem.SetHidesBackButton(true,true); 将其推送到导航 Controller 中。您可以覆盖 ViewWillAppear 并将代码放在那里:

public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);

this.NavigationItem.SetHidesBackButton(true,true);
}

希望对您有所帮助。

一个简单的笔记

由于导航栏对于 UINavigationController 是唯一的,因此按钮将为您在导航 Controller 中推送的所有 Controller 保持其状态。为了解释这个概念,假设您有两个 Controller ,比如 A 和 B。您首先按下 A,然后在它的 ViewWillAppear 方法中隐藏按钮。当您按下 B 时,按钮仍然不可见。如果你想取消隐藏 B 中的按钮,你可以使用它的 ViewWillAppear 方法(像以前一样)等等......

关于iphone - 如何隐藏 UINavigationController 的后退按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12183708/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com