在演示者字典中未配置MvxSidebarPresentationAttribute [英] MvxSidebarPresentationAttribute is not configured in the presenter dictionary
问题描述
未处理的异常
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屋!