什么是负责释放NSWindowController对象? [英] What is responsible for releasing NSWindowController objects?

查看:466
本文介绍了什么是负责释放NSWindowController对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我显示如下的窗口:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆