I'm trying to unde开发者_Python百科rstand how Cocoa does its thing. The Cocoa Template's App Delegate file is this:
#import "Dataminer_ClientAppDelegate.h"
@implementation Dataminer_ClientAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
}
@end
I see no reference do the MainMenu.xib anywhere, just an the window IBOutlet.
Looking at main.m
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}
This guy - NSApplicationMain - must be doing some magic. Is this documented somewhere?
Is there any way to disable all that and let me do things from scratch? (ie: load the XIB myself)
Some of the best material I've found on this subject is here:
- http://cocoawithlove.com/2009/01/demystifying-nsapplication-by.html
- http://cocoawithlove.com/2008/03/cocoa-application-startup.html
The first link goes so far as to try and recreate what NSApplicationMain()
is doing under the hood.
精彩评论