What class is called first in Objective-C program?
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 yo开发者_如何学运维ur program which one is called first?
The starting point is not in a class but in the main
function, same as regular C:
int main( int argc, const char *argv[] )
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.
The first thing called is main
, just like in C. This function usually calls UIApplicationMain
, 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.
精彩评论