【问题标题】:How to navigate to a new Screen when using SideBarController in Xamarin.iOS在 Xamarin.iOS 中使用 SideBarController 时如何导航到新屏幕
【发布时间】:2016-05-13 16:00:37
【问题描述】:

我有一个包含很多屏幕的应用程序,比如说主页、部分屏幕和详细信息页面、类别屏幕。

我使用 NavigationController 从主页导航到部分屏幕。

在 SectionScreen 中,我使用了 SideBarController 组件 (https://components.xamarin.com/view/sidebarnavigation) 来实现抽屉式导航或弹出菜单。

问题是如何从Section Screen 导航到Detail PageCategory Screen。我需要从MenuControllerContentController 进行这种导航。

我不想只更改contentView。我想再推一个UIViewController

我用的是常用的:

this.NavigationController.PushViewController( new UIViewControllerExample(), true);

但是有一些问题:

  • 在详细信息页面我无法访问NavigationBar
  • 当我按back 时,应用程序崩溃并出现错误:

    无法将自身添加到子视图

这就是它的样子。

这就是问题所在。第一张图片显示了当我使用上面的代码时会发生什么,

知道如何解决这个问题。

【问题讨论】:

    标签: uinavigationcontroller xamarin.ios sidebar


    【解决方案1】:

    您可以在该组件页面中找到您应该使用 SidebarController 作为您的导航控制器

      SidebarController.ChangeContentView(new OtherContentController());
    

    【讨论】:

    • 我知道,但正如我上面所说,我不想更改 contentView,我需要在新屏幕中导航。
    猜你喜欢
    • 1970-01-01
    • 2019-06-07
    • 1970-01-01
    • 2021-08-05
    • 2021-05-16
    • 2019-09-25
    • 1970-01-01
    • 2023-03-31
    • 2021-12-19
    相关资源
    最近更新 更多