UIApplication详解

入口函数解析:

@autoreleasepool {

       return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

}

// 第三个参数:UIApplication类名或者子类名称,其中nil=@"UIApplication

// 第四个参数:UIApplication的代理的名称

NSStringFromClass:可以把类名转换成字符串,使用NSStringFromClass的好处:

1)有提示功能 2)避免输入错误.

也可以使用:

return UIApplicationMain(argc, argv, @"UIApplication", @"AppDelegate");


Discussion

This function instantiates the application object from the principal class and instantiates the delegate (if any) from the given class and sets the delegate for the application. It also sets up the main event loop, including the application’s run loop, and begins processing events. If the application’s Info.plist file specifies a main nib file to be loaded, by including the NSMainNibFile key and a valid nib file name for the value, this function loads that nib file.

你可能感兴趣的:(UIApplication详解)