In 99.9% of all cases, there is no need to touch main.m
.
In the other 0.1%, you might want to change the arguments of the call to the UIApplicationMain()
function. The last two arguments of this function specify the names of the classes that represent your main application (UIApplication
by default) and the application delegate.
Should you ever decide to subclass UIApplication
, you would set the third argument to the name of your subclass. Subclassing UIApplication
can be useful if you want to intercept certain events your app handles (override sendEvent:
).
The name of your app delegate class might change if you simply decide to rename that class. Also, if the fourth argument to UIApplicationMain()
is nil
(which is the default in project templates that do not use Storyboarding in iOS 5), it signifies that you create your app delegate object in your app's main NIB file. Should you ever decide to change that decision (e.g., to adapt Storyboarding for an existing project), you would have to change the fourth argument in order to tell UIApplicationMain()
the name of the class it should instantiate.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…