什么是负责释放NSWindowController对象? [英] What is responsible for releasing NSWindowController objects?
问题描述
假设我显示如下的窗口:
Lets say I display a window like so:
[[TBAddTaskWindowController new] showWindow:self];
[[TBAddTaskWindowController new] showWindow:self];
TBAddTaskWindowController对象是在哪里发布的?是通用解决方案在windowWillClose中调用[自我释放]?
Where is the TBAddTaskWindowController object meant to be released? Is the generic solution to call [self release] in windowWillClose?
它不感觉有任何其他对象拥有窗口,因为它的意思是存在。
It doesn't feel right to have any other object "own" the window, because it's meant to exist until the user closes it.
推荐答案
同样的代码通过发送 new
和 init
消息来处理类,
The same code that instantiated the window controller by sending the new
message to the class, just the same as if it had done it by alloc
and init
messages.
这篇关于什么是负责释放NSWindowController对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!