• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Close/Minimize the app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Close/Minimize the app (From: Symadept <email@hidden>)
 >Re: Close/Minimize the app (From: Nick Zitzmann <email@hidden>)
 >Re: Close/Minimize the app (From: Symadept <email@hidden>)
 >Re: Close/Minimize the app (From: kirankumar <email@hidden>)

  • Prev by Date: Re: Multiple variable rules in for() statement
  • Next by Date: Re: Drag-Move the Transparent windowed app over the screen
  • Previous by thread: Re: Close/Minimize the app
  • Next by thread: Mute/Unmute audio device
  • Index(es):
    • Date
    • Thread