2010-11-26 5 views
12

NSWindow를 닫아야 할 때 어떻게 알아야합니까? windowWillClose와 같은 것을 가지고 싶습니다. 불행히도 NSWindowController에는 UIViewController만큼 편리한 메소드가 없습니다. 그렇게하는 것이 가장 좋은 방법은 무엇입니까? 이 닫히려고 할 때NSWindow가 닫힐 때 알림을 얻는 방법

감사 -f

답변

22


NSWindow 문서에 따르면, 윈도우는 NSWindowWillCloseNotification 통지를 게시 할 예정입니다. 컨트롤러가이 알림을 볼 수 있습니다.

+12

또한 위임자에게 'windowWillClose :'메시지를 보냅니다. http://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSWindowDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/ intfm/NSWindowDelegate/windowWillClose : Cocoa는'windowWillClose :'와 매우 흡사합니다. ☺ –

+0

거기에'windowDidClose' 같은 것이 있습니까? – Tony

+0

windowDidClose와 같은 것이 없습니다. NSWindowWillCloseNotification 또는 delegate windowWillClose를 수신 대기해야합니다. – jdumay

관련 문제