阐明窗口控制器的使用
我一直在学习何时使用 WindowController 以及何时将内容放入 Document 对象中。看起来如果你有一个简单的界面,文档可以作为控制器很好地工作。我的应用程序中有一个简单的界面,但是将 IB 出口放入 WC 是一个好的做法吗?当您不想使用卫生间时会出现什么情况?
I've been learning about when to use WindowController and when to put stuff in the Document object. Looks like Document can work fine as a Controller if you have a simple interface. I have a simple interface in my application, but is it a good practice to put IB outlets into WC anyway? What would be a scenario when you would NOT want to use a WC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是一些场景:
在窗口初始化期间,文档将实例化窗口控制器。
发生这种情况后,分离模型控制器和视图控制器的部分目的是删除文档对窗口的依赖。
在完善设计时,请查看文档需要访问窗口的位置,并考虑是否可以以不同的方式实现该功能,例如,通过在窗口控制器而不是文档中处理它。
Here are some scenarios:
During window initialization, the the document will instantiate the window controller.
After that happens, part of the point of separating the model controller and view controller is removing the document's dependency on the window.
As you refine your design, take a look at places where the document needs access to the window, and consider whether you can implement that functionality a different way, for example, by handling it in the window controller instead of the document.