Re: cocoa app from scratch
Re: cocoa app from scratch
- Subject: Re: cocoa app from scratch
- From: Julien Jalon <email@hidden>
- Date: Mon, 19 Jul 2004 07:05:18 +0200
Some very little tweaks:
On Jul 19, 2004, at 3:59, Public Look wrote:
[...]
/* setup things... you should also think about creating and
registering the main menu with [NSApp setMainMenu:] */
[...]
int main()
{
/* Create the autorelease pool */
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
/* use a sub pool here to be sure autoreleased objects
created at setup time are released as soon as possible
(or else they will never be deallocated since they
will be registered to the never-to-be-released top-level
pool)
*/
NSAutoreleasePool *subPool = [[NSAutoreleasePool alloc] init];
/* here: [NSApplication sharedApplication]; (without the assignation)
is sufficient */
/* Create the application object. */
NSApp = [NSApplication sharedApplication];
setup();
[subPool release];
/* run the main event loop until application terminates */
[NSApp run];
/* in facts, we never get here... terminating the application leads to
a simple "exit(0)" */
/* We get here when the user closes the application terminates. */
[pointArray release];
[NSApp release]; /* free the app */
[pool release]; /* release the autorelease pool */
return(EXIT_SUCCESS);
}
--
Julien
_______________________________________________
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.