환경 설정 윈도우를 구현하기 위해 NSWindowController를 사용하고 있습니다. Apple의 설명서에 따르면 컨트롤러와 창은 기본적으로 할당 해제되지 않았기 때문에 모든 것을 다시로드하지 않아도되므로 유용합니다. 그러나 그들의 문서는 당신이 그 행동을 무시할 수는 있지만 어떻게 설명 할 수는 없다고 말합니다.Cocoa NSWindowController 및 NSWindow Deallocing하지 않음
애플의 문서 :
When a window is closed and it is part of a document-based
application, the document removes the window’s window
controller from its list of window controllers. This results
in the system deallocating the window controller and the
window, and possibly the NSDocument object itself. When a
window controller is not part of a document-based application,
closing the window does not by default result in the
deallocation of the window or window controller. This is the
desired behavior for a window controller that manages something
like an inspector; you shouldn’t have to load the nib file
again and re-create the objects the next time the user requests
the inspector.
If you want the closing of a window to make both
window and window controller go away when it isn’t
part of a document, your subclass of NSWindowController
can observe the NSWindowWillCloseNotification notification
or, as the window delegate, implement the windowWillClose: method.
나는 windowWillClose에서 "구현"에 대해 설명이 어디서든 찾을 수 없습니다 : 방법을.
창 컨트롤러
여기에서 볼 수있다 : 컨트롤러를 사용 https://github.com/gngrwzrd/gwpreferences/blob/master/GWPreferences/GWPreferences/GWPreferences/GWPrefsWindowController.m여기에서 볼 수있다 : https://github.com/gngrwzrd/gwpreferences/blob/master/GWPreferences/GWPreferences/GWAppDelegate.m - 나는 시도하고 힘 릴리스 오브젝트 일부 다리 캐스팅을 시도하고있다 곳이 코드에서 볼 수 있지만, 작동하지 않습니다.
따라서 GWPrefsWindowController.dealloc 메서드는 호출되지 않습니다. 어떤 아이디어?
감사합니다. 예, 알림을 받았을 때 수행 할 작업에 대한 설명서에서 설명하지 않은 내용입니다. – gngrwzrd
필자는 ARC가 없을 때 문서가 작성되었다고 생각하므로 암시 적으로 'windowWillClose :'에 속성을 릴리스해야한다고 암시 적으로 설명했습니다. –