我正在尝试使用 Clancey FlyoutNavigation,但是我无法让它执行 segue。
我希望它像导航菜单一样工作,所以如果我按“开始”,它会转到 Storyboard上的特定 View
这是我当前的代码,但它根本不起作用。
var navigation = new FlyoutNavigationController {
// Create the navigation menu
NavigationRoot = new RootElement ("Navigation") {
new Section ("Pages") {
new StringElement ("Start"),
}
},
// Supply view controllers corresponding to menu items:
ViewControllers = new [] {
new UIViewController { this.PerformSegue("toError", this) },
},
};
// Show the navigation view
navigation.ToggleMenu ();
View.AddSubview (navigation.View);
最佳答案
我不知道你是否仍然需要帮助解决这个问题,因为这个问题是去年提出的,但我所做的是创建一个自定义菜单 Controller ,它继承了“FlyoutNavigationController”。这样,添加我想从任何 View 导航到的菜单的新实例真的很容易。 我对自定义菜单进行编码的方式是这样的:
首先,我创建了我希望能够导航到的菜单的新实例:
UINavigationController planningViewController = new UINavigationController(new PlanningViewController());
然后我将它们添加到一个数组中:
UIViewController[] viewcontrollers = new [] { planningViewController };
然后我将它们添加到 RootElement 中:
NavigationRoot = new RootElement ("Planning")
{
new Section ("Menu")
{
new StringElement ("Rooster"),
},
};
其余的代码是关于添加用于单击菜单元素的委托(delegate)。我使用单独的 FlyOutDataSource 来处理程序应该引导您到哪个菜单,但这可以在您声明菜单的同一类中完成。您可以使用被点击元素的索引来确定您应该导航到哪个菜单。
关于c# - 弹出式导航 - iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20380795/