Re: Several Cocoa questions
Re: Several Cocoa questions
- Subject: Re: Several Cocoa questions
- From: "Clark S. Cox III" <email@hidden>
- Date: Wed, 27 Feb 2002 13:53:06 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday, February 27, 2002, at 01:19 , Chad Armstrong wrote:
Hello,
I'm fairly new to Cocoa development, and I have several questions which I
hope can make my small application I'm working on, run a little smoother.
1) Closing the app from a button - If there is an Off or Close button in
the program window, what code is necessary to tell the program to shut
down? In Java, this would be fairly simple with a command like:
System.exit(0);
But I am using just Objective-C Cocoa, no Java.
[ NSApp terminate: nil ];
2) How can I create multiple instances/windows of my program? Do I just
create a function which allocates a new instance of the program and that
handles most of the problems?
Which do you want to do? Create multiple instances or multiple windows?
3) When the last window of the program is closed, what code is necessary
to tell the entire program to shut down? Also, how would I link in this
information to my interface, if necessary?
Implement the following in your application's delegate:
- - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication
*)theApplication
{ return YES;
}
- --
Clark S. Cox, III
email@hidden
http://clarkcox.dyndns.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (Darwin)
Comment: For info see
http://www.gnupg.org
iD8DBQE8fSsYd6STocYT1xURAj9JAKCDlWMCM2o/2/XCriy92F3ozyz+FgCgghBX
Ie5Buwmp3zIupnXeaRUKv3E=
=1kzV
-----END PGP SIGNATURE-----
_______________________________________________
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.