首页 > 解决方案 > 从表单到 iOS 的导航服务

问题描述

我需要从表单页面获取视图控制器。IOS有这样的吗

iOS 的 droid 中是否有任何版本

public class NavigationImplementation : INavigationContract
{
public void Push()
{
var second = new Intent(MainActivity.activity, typeof(ScannerActivity));
MainActivity.activity.StartActivity(second);
}
}

标签: xamarin.forms

解决方案


在 Xamarin iOS 中,有两种方法可以导航到下一页。

一个是NavigationController Push,另一个是Model Push

导航控制器推送:

public void Push()
{
    //SecondViewController secondViewController = this.Storyboard.InstantiateViewController("SecondViewController") as SecondViewController;
    SecondViewController secondViewController = new SecondViewController();
    if (secondViewController!= null) {
        this.NavigationController.PushViewController(secondViewController , true);
    } 
}

模型推送:

//SecondViewController secondViewController = this.Storyboard.InstantiateViewController("SecondViewController") as SecondViewController;
SecondViewController secondViewController = new SecondViewController();
this.PresentViewController(secondViewController , true, () => { Console.WriteLine("Push completely"); });

推荐阅读