简体   繁体   English

MvvmCross:显示内置的iOS ViewController

[英]MvvmCross: show a built-in iOS ViewController

I want to present an MCBrowserViewController (a "native" iOS 7 View Controller) in a Xamarin.iOS app using MvvmCross. 我想在使用MvvmCross的Xamarin.iOS应用程序中呈现MCBrowserViewController (“本机” iOS 7视图控制器)。 It appears that there are two ways to accomplish this (as detailed in Integrating third party controller with MVVMCross on MonoTouch ): 看来有两种方法可以完成此操作(如在MonoTouch上将第三方控制器与MVVMCross集成中所详细介绍):

  1. create a Custom Presenter 创建一个自定义演示者
  2. inherit from MCBrowserViewController to provide an EventSource -ViewController, and inherit from the EventSource -ViewController to add the Mvx BindingContext MCBrowserViewController继承以提供EventSource -ViewController,并从EventSource -ViewController继承以添加Mvx BindingContext

I have tried 1 and 2 above (I suspect that 2 is the more correct approach?), but I am not able to actually present the MCBrowserViewController . 我已经在上面尝试过1和2(我怀疑2是更正确的方法吗?),但是我实际上不能呈现MCBrowserViewController I have watched a range of the "N+1 Days of MvvmCross" tutorials but I can't seem to find a tutorial specifically on this. 我看了一系列的“ N + 1 MvvmCross天”教程,但是我似乎找不到专门的教程。

Any help will be greatly appreciated! 任何帮助将不胜感激! I can post the code I wrote in implementing approach 2 above if it will help. 如果有帮助,我可以张贴在实现上述方法2中编写的代码。

THe EventSource inheritance approach you describe is the standard way for cases where you want to build upon the functionality of a pre-built controller. 您描述的EventSource继承方法是要在预构建控制器的功能上构建的情况的标准方法。

However, if MCBrowserViewController is just a modal view which you want to "pop up" and use "as is" from within an existing view, then you can just display this view from within your app. 但是,如果MCBrowserViewController只是要在现有视图中“弹出”并使用“原样”的模式视图,则可以仅在应用程序中显示该视图。

This is how the Tweet sharing plugin works - https://github.com/MvvmCross/MvvmCross/blob/v3.1/Plugins/Cirrious/Share/Cirrious.MvvmCross.Plugins.Share.Touch/MvxShareTask.cs 这就是Tweet共享插件的工作方式-https://github.com/MvvmCross/MvvmCross/blob/v3.1/Plugins/Cirrious/Share/Cirrious.MvvmCross.Plugins.Share.Touch/MvxShareTask.cs

And similarly how the image picker works - https://github.com/MvvmCross/MvvmCross/blob/v3.1/Plugins/Cirrious/PictureChooser/Cirrious.MvvmCross.Plugins.PictureChooser.Touch/MvxImagePickerTask.cs (although this code is a little more complicated to read) 以及图像选择器的工作原理类似-https: //github.com/MvvmCross/MvvmCross/blob/v3.1/Plugins/Cirrious/PictureChooser/Cirrious.MvvmCross.Plugins.PictureChooser.Touch/MvxImagePickerTask.cs (尽管此代码是读起来有点复杂)

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

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