Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在iPhone monotouch中在屏幕之间传输数据(比如Monodroid致力于monotouch)_Iphone_Xamarin.ios - Fatal编程技术网

在iPhone monotouch中在屏幕之间传输数据(比如Monodroid致力于monotouch)

在iPhone monotouch中在屏幕之间传输数据(比如Monodroid致力于monotouch),iphone,xamarin.ios,Iphone,Xamarin.ios,在monodroid中,我使用了意图来进行一些操作。例如,在一个“保存的搜索”和“搜索”页面的应用程序中,我有一个活动,当我想调用此活动时,我使用了如下代码: var filename = SearchFileList [args.Position]; Intent intent = new Intent (this, typeof(SearchAroundYouActivity)); intent.PutExtra (AppCon

在monodroid中,我使用了意图来进行一些操作。例如,在一个“保存的搜索”和“搜索”页面的应用程序中,我有一个活动,当我想调用此活动时,我使用了如下代码:

        var filename = SearchFileList [args.Position];
            Intent intent = new Intent (this, typeof(SearchAroundYouActivity));
            intent.PutExtra (AppConstants.SearchAction, AppConstants.SavedSearch);
            intent.PutExtra (AppConstants.SearchOption, StorageClass .SearchPath +"/" + filename + "/State.rsf");
            intent .PutExtra (AppConstants .SavedSearchName , StorageClass .SearchPath +"/" + filename);
            StartActivity (intent);
然后在“创建”活动中使用以下代码:

action = Intent.GetStringExtra (AppConstants.SearchAction);
            if (action == AppConstants.SavedSearch) {
                NormalFilter = ((RPLApp)Application).typeOfShow.Content .filter .ToString ();
                ((RPLApp)Application).typeOfShow.Load (Intent.GetStringExtra (AppConstants.SearchOption));
                SaveName = Intent .GetStringExtra (AppConstants .SavedSearchName );
            }
通过此方法,我可以检测是否加载保存的数据或运行新的搜索

问题是:我们如何在monotouch中做这样的事情


也许我们可以在screen类中定义一些静态变量,然后检查它们的值,但这样的解决方案是否是一种推荐的、好的和最好的方法?

在iOS上,您应该能够像在C中一样在两个类之间传递这些值。Android在要求东西序列化并通过
Intent
传递方面有点奇怪

例如,您可以在单击事件中执行以下操作:

var myController = new MyController();
myController.SetSomeField = true; //Or pass anything you want in via properties or methods
PresentViewController(myController, true, null);
如果您想获得更多的“跨平台”,您可以为这两个平台使用messenger实现。我有一个,我想MvvmCross正在研究一个——不确定它是否在那里