xamarin.forms - 从表单到 iOS 的导航服务
问题描述
我需要从表单页面获取视图控制器。IOS有这样的吗
iOS 的 droid 中是否有任何版本
public class NavigationImplementation : INavigationContract
{
public void Push()
{
var second = new Intent(MainActivity.activity, typeof(ScannerActivity));
MainActivity.activity.StartActivity(second);
}
}
解决方案
在 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"); });
推荐阅读
- java - FindBugs - 已装箱的值被取消装箱,然后立即重新装箱
- python - 无法连接到主机。Heroku 和不和谐机器人问题
- javascript - 无法读取 null Javascript 的属性“值”
- python - 如何修复 JSONDecodeError?
- angular - Angular (10) 材质 touchUi datepicker - 不能选择任何东西
- bash - /bin/bash: 无效选项ash: -
- java - 当我单击主页 GUI 上的按钮时,会打开一个空白 GUI
- oracle - Oracle PL/SQL - 如果不满足条件,则退出开始结束块
- java - 如果数组中的每个元素都相等,则打印一个元素,而如果所有元素不相等,则打印最大的元素
- javascript - 谷歌脚本删除行