【问题标题】:how to make navigation between pages in xamarin.ios?如何在 xamarin.ios 中的页面之间进行导航?
【发布时间】:2015-01-14 07:42:17
【问题描述】:
我使用下面的代码导致了一个错误,即 InstantiateInitialViewController 方法没有重载采用 '1' 参数
EfficientBilling365ViewController abc=this.Storyboard.InstantiateInitialCiewController(EbViewController) as EfficientBillingViewController;
if(abc!=null)
{
this.NavigationController.PushViewController(abc,true);
}
谁能帮帮我?
【问题讨论】:
标签:
ios
uinavigationcontroller
xamarin
【解决方案1】:
首先从 AppDelegate.cs 创建视图控制器,然后将其封装到 NavigationController 中,如下所示:
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
MyViewController myViewController = new MyViewController ();
UINavigationController navContr = new UINavigationController (myViewController);
window.RootViewController = navContr;
//Other things
}
之后你的 myViewController 是第一页,当你做某事时你会进入新页面,所以在myViewContoller 你会做这样的事情:
NavigationController.PushViewController (newViewController, true);
希望这会有所帮助,不需要故事板,我发现这是在页面之间导航的最简单方法。
【解决方案2】:
我认为这是解决方案!
UIStoryboard Storyboard = UIStoryboard.FromName("Main", null);
var contentController =(product_co)AppDelegate.Storyboard.InstantiateViewController("product_co");
this.NavigationController.PushViewController(contentController, true);