• 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: Quit application when window closes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quit application when window closes


  • Subject: Re: Quit application when window closes
  • From: "Kevin Dixon" <email@hidden>
  • Date: Tue, 11 Mar 2008 15:07:03 -0400 (EDT)
  • Importance: Normal

Your window controller will need the method

- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication
*)inSender
{
	return YES;
}

and then you need to specify the window controller as the delegate for the
application

[NSApp setDelegate:self];

I do that in awakeFromNib, but you may have to find a different solution,
since you're not using Nib files. Hope that helps,

-Kevin

>
> Message: 12
> Date: Tue, 11 Mar 2008 07:22:17 -0300
> From: "Felipe Monteiro de Carvalho"
> 	<email@hidden>
> Subject: Quit application when window closes
> To: "Cocoa-dev list" <email@hidden>
> Message-ID:
> 	<email@hidden>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hello,
>
> How can I implement the behavior that the application closes when my
> window closes?
>
> The application contains no nib files and doesn't use the interface
> builder, it's every thing done by code.
>
> thanks,
> --
> Felipe Monteiro de Carvalho

_______________________________________________

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

  • Follow-Ups:
    • Re: Quit application when window closes
      • From: "Felipe Monteiro de Carvalho" <email@hidden>
  • Prev by Date: Re: Displaying at appropriate time after text layout...?
  • Next by Date: Re: Core Data MOM configurations and renaming...
  • Previous by thread: Re: Quit application when window closes
  • Next by thread: Re: Quit application when window closes
  • Index(es):
    • Date
    • Thread