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

Re: Quit from a Button


  • Subject: Re: Quit from a Button
  • From: Marc Weil <email@hidden>
  • Date: Thu, 24 Apr 2003 19:13:11 -0400

If it's a button in Interface Builder, then you can actually connect its
action to the terminate: method of First Responder.

If the button is programmatically created, or it would be impossible to use
Interface Builder to connect the button to terminate:, then just use this
line of code:
[NSApp terminate: nil];
and that will quit your application. NSApplication is actually part of the
AppKit, so it wasn't a Foundation question after all. ;-)

Hope that helps!

-- Marc Weil


On 4/24/03 6:56 PM, "ryan harlin" <email@hidden> wrote:

> The Basics of my question is: How can you include a
> quit statement in a method?
>
> The Details are as follows:
>
> I am learning cocoa programmming in a sort of
> trial-fire-approach. This week, I've managed to learn
> enough to write my app. It's a full screen app that
> takes over the screen, presents a form that is loading
> info from a plist file, and allows you sign the form
> by drawing a bezier path (form signing via Wacom
> drawing tablet). When a button at the bottom of the
> form is clicked which reads:
>
> Confirm Signature
>
> The app saves a PDF file to a predtermined location.
>
> NOW!!:
>
> In this last method, I'd like to quit the app after
> the writeToFile part is finished.
>
> How can you quit an app without using the menu item:
> "Quit MyApplication"
>
> How can you quit an app by clicking a button?
>
> It seems like such a foundation question to be asking
> after I was able to learn everything else on my own,
> but I just can't find any mention of this out in the
> book/web resource universe.
>
> Thanks for all help.
>
> ryan
> The New Yahoo! Search - Faster. Easier. Bingo
> http://search.yahoo.com
> _______________________________________________
> 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.

References: 
 >Quit from a Button (From: ryan harlin <email@hidden>)

  • Prev by Date: Re: Quit from a Button
  • Next by Date: Re: Quicktime Atoms
  • Previous by thread: Re: Quit from a Button
  • Next by thread: Re: Quit from a Button
  • Index(es):
    • Date
    • Thread