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.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容