美文网首页
UIApplication详解

UIApplication详解

作者: 安卓小书童 | 来源:发表于2016-11-20 16:07 被阅读0次

入口函数解析:

@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详解

      本文链接:https://www.haomeiwen.com/subject/yjkypttx.html