在Xamarin.iOS中按代码打开页面

时间:2017-04-07 13:24:42

标签: xamarin xamarin.ios

下面的代码导航到Swift中的页面 如何在Xamarin.iOS中运行此代码?

let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)

let nextViewController = storyBoard.instantiateViewControllerWithIdentifier("nextView") as NextViewController
self.presentViewController(nextViewController, animated:true, completion:nil)

1 个答案:

答案 0 :(得分:3)

这是翻译:

var storyboard = UIStoryBoard.FromName("Main",null);
var nextViewController = storyboard.InstantiateViewController("nextView") as NextViewController;
PresentViewController(nextViewController, true, null);

或者如果您使用异步等待:

var storyboard = UIStoryBoard.FromName("Main",null);
var nextViewController = storyboard.InstantiateViewController("nextView") as NextViewController;
await PresentViewControllerAsync(nextViewController, true);