Re: Close/Minimize the app
Re: Close/Minimize the app
- Subject: Re: Close/Minimize the app
- From: Andrew Farmer <email@hidden>
- Date: Fri, 13 Nov 2009 23:12:48 -0800
On 11 Nov 2009, at 21:23, kirankumar wrote:
> this will help you
> keep this 3lines of code in awakeFromNib, and mpwindow is you are window name.
>
> id closeButton = [mpWindow standardWindowButton:NSWindowCloseButton ];
> [closeButton setAction:@selector(closeapp:)];
> [closeButton setTarget:self];
No, don't do that. See -[NSApplication applicationShouldTerminateAfterLastWindowClosed:] for the correct approach.
> - (IBAction)closeapp:(id)sender
> {
> exit(0);
> }
I'm pretty sure that this will end up skipping most cleanup routines (including important ones, like syncing dirty preferences). NSApplication has a terminate: method for a reason._______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden