在演示者字典中未配置MvxSidebarPresentationAttribute [英] MvxSidebarPresentationAttribute is not configured in the presenter dictionary

查看:69
本文介绍了在演示者字典中未配置MvxSidebarPresentationAttribute的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

未处理的异常

Unhandled Exception

System.Collections.Generic.KeyNotFoundException : MvxSidebarPresentationAttribute类型未在 演示者字典

System.Collections.Generic.KeyNotFoundException: The type MvxSidebarPresentationAttribute is not configured in the presenter dictionary

  • MvvmCros 5.6工具
  • Visual Studio 2015
  • Windows 8.1
  • iPhone 7模拟器iOS 10.3
    • MvvmCros 5.6 Tools
    • Visual studio 2015
    • Windows 8.1
    • iPhone 7 simulator iOS 10.3

    • 代码
      菜单视图

      code
      Menu View

          [MvxFromStoryboard("Main")]
          [MvxSidebarPresentation(MvxPanelEnum.Left, MvxPanelHintType.PushPanel, false)]
          public partial class MenuViewController : MvxViewController<MenuViewModel>
          {
              public MenuViewController(IntPtr handle) : base(handle)
              {
              }
      
              public MenuViewController() : base("MenuViewController", null)
              {
              }
      
              public override void DidReceiveMemoryWarning()
              {
                  // Releases the view if it doesn't have a superview.
                  base.DidReceiveMemoryWarning();
      
                  // Release any cached data, images, etc that aren't in use.
              }
              public override void ViewDidLoad()
              {
                  base.ViewDidLoad();
                  var set = this.CreateBindingSet<MenuViewController, MenuViewModel>();
                  set.Bind(btnFirst).To(vm => vm.GotoFirstView);
                  set.Bind(btnSecond).To(vm => vm.GotoSecondView);
                  set.Apply();
                  // Perform any additional setup after loading the view, typically from a nib.
              }
      }
      

      第一视图

      [MvxFromStoryboard("Main")]
      [MvxSidebarPresentation(MvxPanelEnum.Center, MvxPanelHintType.ResetRoot, true)]
      public partial class FirstViewController : MvxViewController<FirstViewModel>
      {
          public FirstViewController() : base("FirstViewController", null)
          {
          }
      
          public FirstViewController(IntPtr handle) : base(handle)
          {
          }
          public override void DidReceiveMemoryWarning()
          {
              base.DidReceiveMemoryWarning();
      
              // Release any cached data, images, etc that aren't in use.
          }
      
          public override void ViewDidLoad()
          {
              base.ViewDidLoad();
      
              // Perform any additional setup after loading the view, typically from a nib.
          }
      }
      

      第二次观看

      [MvxFromStoryboard("Main")]
          [MvxSidebarPresentation(MvxPanelEnum.Center, MvxPanelHintType.ResetRoot, true)]
          public partial class SecondViewController : MvxViewController<SecondViewModel>
          {
              public SecondViewController() : base("SecondViewController", null)
              {
              }
      
              public SecondViewController(IntPtr handle) : base(handle)
              {
              }
      
              public override void DidReceiveMemoryWarning()
              {
                  base.DidReceiveMemoryWarning();
      
                  // Release any cached data, images, etc that aren't in use.
              }
      
              public override void ViewDidLoad()
              {
                  base.ViewDidLoad();
      
                  // Perform any additional setup after loading the view, typically from a nib.
              }
          }
      

      我在我的ios项目中使用了上面的代码,但是它只是在ouptut中显示错误为
      未处理的异常

      i have used above code in my ios project but it just showing error in ouptut as
      Unhandled Exception

      System.Collections.Generic.KeyNotFoundException:演示者字典中未配置类型MvxSidebarPresentationAttribute

      System.Collections.Generic.KeyNotFoundException: The type MvxSidebarPresentationAttribute is not configured in the presenter dictionary

      推荐答案

      您必须在iOS项目的Setup.cs文件中使用MvxSidebarPresenter:

      You have to use the MvxSidebarPresenter in the Setup.cs file of your iOS project:

      protected override IMvxIosViewPresenter CreatePresenter()
      {
         return new MvxSidebarPresenter((MvxApplicationDelegate)ApplicationDelegate, Window);
      }
      

      您可以看到工作示例 .

      这篇关于在演示者字典中未配置MvxSidebarPresentationAttribute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆