OGeek|极客世界-中国程序员成长平台

标题: ios - 将 MvvmCross 与 UIPageViewController 一起使用 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 02:29
标题: ios - 将 MvvmCross 与 UIPageViewController 一起使用

是否可以将 UIPageViewController(iOS) 与 MvvmCross 一起使用?

我已将两者都与 Xamarin 一起使用,但我现在正尝试将其与 MvvmCross 一起使用。

我基本上到了需要设置 UIPageViewControllerDataSource 的地步,这需要我重写这些方法:

public override UIViewController GetNextViewController(UIPageViewController pageViewController, UIViewController referenceViewController)
public override UIViewController GetPreviousViewController(UIPageViewController pageViewController, UIViewController referenceViewController)

这两者都给了我一个 UIViewController 而不是 MvxViewController。

我对 MvvmCross 非常陌生,可能遗漏了一些东西,但我可以看到还有其他源类,例如 MvxTableViewController 的 MvxSimpleTableViewSource,我会想象可能有一个带有 MvxPageViewControllerDataSource 的 MvxPageViewController?

我还看到 CheeseBaron 为 android here 中的 PagerAdapter 创建了一个绑定(bind)。 .所以我猜这是不可能开箱即用的,但如果我像 CheeseBaron 那样创建自己的绑定(bind),我可以吗?

我说的对吗?还是有其他方法?



Best Answer-推荐答案


我尝试解决这个问题,见 my article here ,以及 GitHub repo .

简短的版本,我没有使用 UIPageViewController,而是使用 UIPageControl/UIScrollView 组合为 iOS 定制了一个演示器。

关于ios - 将 MvvmCross 与 UIPageViewController 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26300657/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4