问题描述
新的Google AnalyticsSDK为> UIViewController
引入了一个新的子类,您必须从中继承: GAITrackedViewController
。
更多信息:
这显然与 MvxBindingTouchViewController ,因为您只能从C#中的一个类继承。
推荐使用这种方法的推荐方式是什么?
$ MvvmCross的MvxTouchViewController是特殊的... MvvmCross的MvxBindingTouchViewController更加特别.. 。
但这些只是特别的,它们继承自标准UIViewControllers(UIVIewController,UITableViewController,UITabBarController等),然后添加以下功能:
- ViewModel构建和Cirrious.MvvmCross层的ViewModel属性
- 在Cirrious.MvvmCross.Binding图层上构建和存储绑定
看一些例子: 和 和
在这些你可以希望看到这涉及到相当数量的代码剪切和粘贴 - 尽管我们尝试使用扩展方法将其最小化。 (如果C#有多个继承或mixin,我们不需要这样做 - 我很想拥有Mixins,但是不想多次进行Inhertitance!)
如果你想添加你自己的MvxXXXXXBindingViewController,那么:
- 带上你的基地XXXXX类, >
- 从它继承并添加'the stuff'来创建一个MvxXXXXViewController,然后带上您的MvxXXXXXViewController并再次继承它以使您的MvxBindingXXXXXViewController
- 发布到您的博客和新的GitHub仓库,以便其他人可以搭载您的辛勤工作
- 完成任务
高级备注: 如果您想在Droid中看到相同的内容,请参阅 TabBarController也很有趣 - 它有一些额外的方法。 在'不久'(今年上半年)的某个时刻,我们将创建VeeThree,这将会切换MvxViewController是非通用格式 - 这是因为MonoTouch现在建议不要在iOS基类中使用泛型 - Rolf说大部分时间都是安全的,但是当它引发错误时,它们就是'heisenbugs'。 当前类(ViewDidUnload)中也存在一些无效的旧iOS代码 - 此代码也将在VeeThree中被淘汰。 The new Google Analytics SDK introduces a new subclass to More info here: https://developers.google.com/analytics/devguides/collection/ios/v2/screens This obviously clashes with What's the recommended way in getting this working? MvvmCross's MvxTouchViewController's is special... MvvmCross's MvxBindingTouchViewController is even more special... But these are only special in that they inherit from standard UIViewControllers (UIVIewController, UITableViewController, UITabBarController, etc) and then they add functionality for: Take a look at some examples: https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross.Touch/Views/MvxTouchViewController.cs and https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross.Binding.Touch/Views/MvxBindingTouchViewController.cs https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross.Touch/Views/MvxTouchTableViewController.cs and https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross.Binding.Touch/Views/MvxBindingTouchTableViewController.cs https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross.Touch/Views/MvxTouchCollectionViewController.cs and https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross.Binding.Touch/Views/MvxBindingTouchCollectionViewController.cs In these you can hopefully see this involves a fair amount of cut and paste of code - although we do try to minimise it using extension methods. (If C# had multiple inheritance or mixins, we wouldn't need to do that - I'd love to have Mixins... but don't want multiple inhertitance ever!) So.... if you want to add your own MvxXXXXXBindingViewController, then: Advanced notes: If you want to see the same thing in Droid, see Insert a Monogame view inside MvvmCross monodroid Activity The TabBarController is also interesting - it's got some additional methods At some point 'soon' (first half of this year) we will create VeeThree and this will switch the MvxViewController's to a non generic format - this is because MonoTouch now recommends against using Generics on iOS base classes - Rolf says it's safe most of the time, but when it causes bugs they are 'heisenbugs'. There is also some dead old-iOS code in the current classes (ViewDidUnload) - this code will be culled in VeeThree too. 这篇关于将Google移动分析与MVVMCross整合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
ul> UIViewController
from which you have to inherit: GAITrackedViewController
.MvxBindingTouchViewController
, as you can only inherit from one class in C#.