我在让 RefreshRequested 事件在实现 DialogViewController 的 ViewController 之一中工作时遇到一些问题:
public CustomViewController () : base (null, true) {
RefreshRequested += delegate {
...
ReloadComplete ();
};
}
我从另一个 ViewController 调用 CustomViewController
,如下所示:
var dvc = new CustomViewController();
this.ActivateController(dvc);
我收到的错误消息是“顶级异常:System.ArgumentException:您应该在显示 Controller 之前设置处理程序”
我在这里做什么有什么指示吗?谢谢
最佳答案
看起来您没有指定 RootElement
,即您自己的构造函数将其设置为 null
,因此您会收到警告,内部状态尚未准备好设置事件。
您应该使用构造函数创建一个空的RootElement
,然后向其中添加内容(使用属性)。这应该允许您在自己的构造函数中设置事件。例如
public CustomViewController () : base (new RootElement (String.Empty), true)
Any pointers of what I am doing from here?
如有疑问,您总能看到整个 source code MonoTouch.Dialog 在它的 github 存储库中。
关于xamarin.ios - 单触摸DialogViewController刷新请求 "System.ArgumentException: You should set the handler before the controller is shown",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9369396/