What does the app delegate do in a xcode project?
Ok, so when I create a new cocoa project, there's always 2 files that's created for me. That's the .h
and the .m
NAME AppDelegate
file. I've read a lot of books about cocoa and the documentary from apple that told me to create new files i开发者_如何学Cnstead of using it. What's the point of those 2 files anyways? And is it safe to delete them?
Do not delete the App Delegate! This deals with the main "delegate" notifications for the application like:
When the application finished loading an is ready for you to add your first controller:
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
When the application terminates:
-(void)applicationWillTerminate:(UIApplication *)application;
Check out this post for more information on the app delegate.
The application delegate is one of the most important files in your project!
ProjectNameAppDelegate.h
and ProjectNameAppDelegate.m
files are created automatically during project creation. These are the first files to be executed. Consider them like a bootstrap for your application.
精彩评论