下面的代码导航到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)
答案 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);