Monotouch:我必须处置视图吗?
在我的 AppDelegate 中,我有一个名为 LoggedOn 的静态事件。
我的父视图控制器推送客户端视图控制器。我的客户端视图控制器将委托添加到 AppDelegate.LoggedOn 事件。
当我弹出客户端视图控制器时,LoggedOn 事件的侦听器仍在侦听.. emmmmm ...我需要将其丢弃还是其他什么?
我以为当我弹出它时整个客户端视图就被处理掉了?
谢谢! 莫乔
In my AppDelegate, I have a static event called LoggedOn.
My parent viewcontroller pushes a client viewcontroller.My client viewcontroller adds a delegate to the AppDelegate.LoggedOn event.
When I pop the client viewcontroller, the listner for the LoggedOn event is still listening .. emmmmm ... do I need to like dispose it or something?
I thought the whole client view was disposed when I pop'ed it?
Thanks!
Mojo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好将 EventHandler 处理为全局事件,例如您拥有的 LoggedOn 事件。这些称为强引用,会阻止包含委托的 ViewController 被垃圾回收。
我会在 ClientViewController 中做这样的事情:
It's best to dispose of EventHandlers to global events like the LoggedOn event you have. These are called strong references and would prevent the ViewController that contains the delegate from being garbage collected.
I would do something like this in the ClientViewController: