Re: Terminate on Close
Re: Terminate on Close
- Subject: Re: Terminate on Close
- From: Darwin Zins <email@hidden>
- Date: Wed, 12 Nov 2003 19:17:56 -0600
What I did was add the following code to my controller class:
- (BOOL) applicationShouldTerminateAfterLastWindowClosed:
(NSApplication *) theApplication {
return YES;
}
Then I opened up the MainMenu.nib file and control dragged a line from
the File's Owner icon to my class and connected it to the delegate
outlet. I seem to remember from something I read in the last few days
that the File's Owner of MainMenu.nib is NSApp right?
This works, is this the correct or preferred way to do this?
Thanks again,
Darwin
On Nov 12, 2003, at 6:26 PM, Wade Tregaskis wrote:
>
> Another newb question. How do I get an Objective-C application to
>
> terminate when the users presses the close button?
>
>
Look at the documentation for NSApplication - there's a delegate
>
method which allows you to return whether or not the app should quit
>
when the last window is closed.
>
>
Wade Tregaskis
>
-- Sed quis custodiet ipsos custodes?
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.