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

Re: Quit Application


  • Subject: Re: Quit Application
  • From: Fritz Anderson <email@hidden>
  • Date: Sat, 4 Jun 2005 17:48:56 -0500

On 4 Jun 2005, at 5:35 PM, Connor Wakamo wrote:
Sorry if my posts seem easy to answer.

Your post would be easier to answer if it included not only a statement of what you did, but why you found what you did unsatisfactory. In other words, what your question is, and why you are asking it.


I need a way to quit my application by pressing a button on the window. I use this code:
[app terminate];
where app is the outlet representing my NSApplication.

First, you don't need to keep an outlet for your application. There's a global, NSApp, for the application object.


Second, NSApplication does not define a terminate method. It does define a terminate: method. The colon is significant. So your button handler would be

- (IBAction) doQuitButton: (id) sender
{
    [NSApp terminate: sender];
}

    -- F

 --
Fritz Anderson
Consulting Programmer
http://resume.manoverboard.org/


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Quit Application
      • From: Connor Wakamo <email@hidden>
References: 
 >Quit Application (From: Connor Wakamo <email@hidden>)

  • Prev by Date: writeToFile:ofType:originalFile:saveOperation: on Tiger
  • Next by Date: Re: Quit Application
  • Previous by thread: Quit Application
  • Next by thread: Re: Quit Application
  • Index(es):
    • Date
    • Thread