我开始使用xamarin来创建ios软件。 在mainstoryboard中,我将PageMain视图控制器导航到PageTo查看控制器。 我想从PageMain视图控制器导航到PageTo查看控制器。我使用此代码并没有自动导航:
var storyBoard = UIStoryboard.FromName ("MainStoryboard", null);
storyBoard.InstantiateViewController ("PageTo");
也尝试了这个,但也没有自动导航:
PageMainViewController *viewController = segue. PageToViewController;
viewController.delegate = self;
也尝试了这个,但也没有自动导航:
UIViewController pageto = new PageTo ();
pageto.Transition (PageMain, PageTo);
我知道,更容易使用按钮为PageTo视图控制器创建推送序列,但我不想要它。 请帮帮我。
答案 0 :(得分:0)
我希望这有帮助,我只需要这样做。
// Clear your notifications and other things
// Show the controller
// I am assuming your are using storyboards based in your use of Handle. I am also assuming the identifier in your storyboard for this is set to "WebViewController and its a custom subclass of UIViewController named WebViewController.
UIStoryboard Storyboard = UIStoryboard.FromName ("MainStoryboard", null); // Assume the name of your file is "MainStoryboard.storyboard"
var webController = Storyboard.InstantiateViewController("WebViewController") as WebViewController;
// ... set any data in webController, etc.
// Make it the root controller for example (the first line adds a paramater to it)
webController.CaseID = int.Parse(notification.UserInfo["ID"].ToString());
this.Window.RootViewController = webController;
// Note* the "Window" should already be set and created because the app is running. No need to remake it.
答案 1 :(得分:0)
你可以做的另一件事是推送到另一个视图控制器......
AssignCaseController assignCaseController = this.Storyboard.InstantiateViewController("AssignCaseController") as AssignCaseController;
if (assignCaseController != null)
{
assignCaseController.CaseID = GetCurrentCaseID();
this.NavigationController.PushViewController(assignCaseController, true);
}