简体   繁体   English

Xamarin.ios 的新页面

[英]New Page on Xamarin.ios

first off all I want to mention that I am very new to Xamarin.首先,我想提一下,我对 Xamarin 很陌生。

I have created a login page for my app but I need a new page to use as main menu.我为我的应用程序创建了一个登录页面,但我需要一个新页面用作主菜单。 The new page should be editable on Xcode to design it's UI.新页面应该可以在 Xcode 上编辑以设计它的 UI。 It also needs a ViewController.cs to run some code inside it.它还需要一个 ViewController.cs 来在其中运行一些代码。

Is there any possible ways that I can create a page which needs my requirements that I have just mentioned?是否有任何可能的方法可以创建需要我刚才提到的要求的页面?

I solved the issue by creating a new ViewControl in Xcode then I specified it's class at identity inspector and I also gave it a storyboard ID from the same menu.我通过在 Xcode 中创建一个新的 ViewControl 解决了这个问题,然后我在身份检查员处指定了它的 class 并且我还从同一个菜单中给了它一个 storyboard ID。

Then I wrote the following code to display the new ViewControl.然后我编写了以下代码来显示新的 ViewControl。

        MainViewController mainViewController = this.Storyboard.InstantiateViewController("MainViewController") as MainViewController;
        mainViewController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
        PresentViewController(mainViewController, true, null);

MainViewController is the class that I mentioned in identity inspector and second MainViewController which is inside the quotation mark is my storyboard ID. MainViewController 是我在身份检查器中提到的 class,引号内的第二个 MainViewController 是我的 storyboard ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM