菜鸟教程小白 发表于 2022-12-13 02:29:52

ios - 将 MvvmCross 与 UIPageViewController 一起使用


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

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

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

<pre><code>public override UIViewController GetNextViewController(UIPageViewController pageViewController, UIViewController referenceViewController)
public override UIViewController GetPreviousViewController(UIPageViewController pageViewController, UIViewController referenceViewController)
</code></pre>

<p>这两者都给了我一个 UIViewController 而不是 MvxViewController。</p>

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

<p>我还看到 CheeseBaron 为 android <a href="https://github.com/Cheesebaron/Cheesebaron.MvvmCross.Bindings" rel="noreferrer noopener nofollow">here</a> 中的 PagerAdapter 创建了一个绑定(bind)。 .所以我猜这是不可能开箱即用的,但如果我像 CheeseBaron 那样创建自己的绑定(bind),我可以吗?</p>

<p>我说的对吗?还是有其他方法?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我尝试解决这个问题,见 <a href="http://benjaminhysell.com/archive/2014/11/mvvmcross-unified-xamarin-android-viewpager-and-xamarin-ios-uipagecontroluiscrollview-example/" rel="noreferrer noopener nofollow">my article here</a> ,以及 <a href="https://github.com/benhysell/Cheesebaron.MvvmCross.Bindings" rel="noreferrer noopener nofollow">GitHub repo</a> . </p>

<p>简短的版本,我没有使用 <code>UIPageViewController</code>,而是使用 <code>UIPageControl/UIScrollView</code> 组合为 iOS 定制了一个演示器。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 将 MvvmCross 与 UIPageViewController 一起使用,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/26300657/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/26300657/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 将 MvvmCross 与 UIPageViewController 一起使用