• 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: Terminate on Close
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Terminate on Close
      • From: Wade Tregaskis <email@hidden>
References: 
 >Re: Terminate on Close (From: Wade Tregaskis <email@hidden>)

  • Prev by Date: Auto Generating HTML and PDF Documentation?
  • Next by Date: Re: Matching Postal Addresses
  • Previous by thread: Re: Terminate on Close
  • Next by thread: Re: Terminate on Close
  • Index(es):
    • Date
    • Thread