user15165467
user15165467

Reputation:

Run code when the NSWindow is closed using isReleasedWhenClosed

I'm building a cocoa application, I created a nswindow programatically and I use the isReleasedWhenClosed to false. When I do that, I do not get alerts of the func windowWillClose. I want to know how I can execute code when the user closes the window in isReleasedWhenClosed

Upvotes: 0

Views: 311

Answers (1)

seth
seth

Reputation: 1708

isReleasedWhenClosed will have no affect on how the window is closed, it literally only changes whether the window has a release call sent to it or not, for teardown if nothing else references it.

If your windowWillClose notification is not being fired on your properly setup delegate, then the window isn't technically being closed. If the window is simply being "ordered out", that's not technically the same as "closing" according to the API.

Upvotes: 1

Related Questions