首页 文章

删除导航栏中的后退箭头,保留后退按钮 Headers

提问于
浏览
1

我有xamarin表单ios应用程序,我需要删除导航栏中的后退箭头,但应显示 Headers ,当用户点击该后退按钮 Headers 时,它应导航到上一个视图 . 我试过用`

NavigationPage.SetBackButtonTitle(this, "Cancel");

NavigationPage.SetHasBackButton(this, false);

但后面的箭头仍然显示,有没有为什么只有文字 Cancel 没有 < 符号?

3 回答

  • 0

    删除导航栏并在导航位置使用 image/header 并将 image/Header 写入 navigation title ...

    image onclick event into write back command

  • 1

    我通过添加自定义渲染器解决了我的问题,如下所示

    public override void ViewWillAppear(bool animated)
    {      
        base.ViewWillAppear(animated);
        this.NavigationController.TopViewController.NavigationItem.LeftBarButtonItem =new UIBarButtonItem(“Cancel”, UIBarButtonItemStyle.Plain, (sender, args) => { });      
    }
    
  • 0

    AppDelegate.cs 文件中,在 FinishedLaunching 方法中添加以下行:

    UINavigationBar.Appearance.BackIndicatorImage = new UIImage();
    UINavigationBar.Appearance.BackIndicatorTransitionMaskImage = new UIImage();
    

    但是,这将删除每个页面 . 如果你只想要一个页面,我建议像EvZ已经提到的那样:使用模态页面或找到另一种方式 .

    另一种方法是将上面的行设置为 null ,这将恢复正常的箭头 . 但这意味着要实现自定义渲染器,依赖服务或类似工具 .

相关问题