ios - MvvMCross 向后导航多个 View 模型/截断导航堆栈

标签 ios xamarin.ios navigation xamarin mvvmcross

我有两个关于 MvvMCross 导航的问题。

  1. 如何返回导航堆栈上的 View 模型?分别:如何返回指定数量的 View 模型?
  2. 如何截断导航堆栈?

    例如:A|B|C 在堆栈上,导航到 D 使堆栈看起来像:D

最佳答案

操作返回堆栈的功能是特定于平台和应用程序的——例如:

  • 操作 Android 事件后台堆栈与操作 iOS UINavigation Controller 有很大不同
  • 这取决于您的应用是否使用选项卡、事件、片段、浮出控件、模式、汉堡菜单等

因此,像这样的 UI 更改的实际实现并未在 MvvmCross 中定义。

相反,这取决于您在您的应用程序中实现 presenter

您需要遵循的基本流程是:

  1. 弄清楚您的应用程序结构是什么以及您想要实现什么效果

  2. 为此效果,声明一个自定义呈现提示 - 例如

    public class MyFunkyPresentationHint : MvxPresentationHint
    {
        public int DegreeOfFunkiness { get; set; } 
    }
  1. 您可以从任何 ViewModel 创建和发送此提示
    base.ChangePresentation(new MyFunkyPresentationHint() { DegreeOfFunkiness=27 });
  1. 然后在您的自定义演示器中,您可以执行您想要的后台堆栈屏幕黑客操作:
    public override void ChangePresentation(MvxPresentationHint hint)
    {
        if (hint is MyFunkyPresentationHint)
        {
            // your code goes here
            return;
        }

        base.ChangePresentation(hint);
    }

有关自定义演示者的示例,请参阅:http://slodge.blogspot.com/2013/06/presenter-roundup.html

有关后台操作的示例,请参阅如何在一些标准演示器中实现 Close(this)

关于ios - MvvMCross 向后导航多个 View 模型/截断导航堆栈,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17474865/

相关文章:

azure - DocumentDB + Xamarin - 授权 token 无效

html - 行为不同的订单项

ios - 将 TapGestureRecogniser 添加到 UITextView

objective-c - 在单点触控中构建静态库

ios - Swift 中带有 UISegmentedControl 的 VoiceOver

xamarin.ios - MonoTouch.Dialog:让 StringElement 拥有 AccessoryView

MVVM Light 导航服务 - windows rt 中的参数

android - Google Docs Android 应用导航顶部栏

android - 使用cordova将android图库中的图片分享到cordova应用程序

iPhone:什么是 WWDR 中间证书?