Objective-C 程序中首先调用哪个类?
在Java中,我们可以指定程序启动时调用的类。它必须有 public static void main
.. 你知道该怎么做。
在Objective-C
中怎么样?在程序中可能存在的所有类中,哪一个首先被调用?
In Java one can specify the class what class is called when program starts. It must have public static void main
.. you know the drill.
How about in Objective-C
? Of all the classes you may have present in your program which one is called first?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
起点不在类中,而是在
main
函数中,与常规 C 相同:对于 iOS 应用程序,通常会为您生成该函数,并将控制权传递到您的
UIApplicationMain
中>。有关更多信息,请参阅文档中有关主函数的部分 此处。
The starting point is not in a class but in the
main
function, same as regular C:For an iOS app, this is generally generated for you and control is passed into your
UIApplicationMain
.For more information, see the section on the main function in the docs here.
首先调用的是
main
,就像在 C 中一样。该函数通常调用UIApplicationMain
,后者根据包的 plist 文件的内容创建主应用程序对象,然后执行应用程序的事件循环。The first thing called is
main
, just like in C. This function usually callsUIApplicationMain
, which in turn creates the main application object, based on the contents of the bundle's plist file, and then executes the application's event loop.