Programs are all imported from the Main method IOS is no exception
int main (int argc,char * argv[])
{
@autoreleasepool {
Return Uiapplicationmain (argc, argv, Nil, Nsstringfromclass ([Appdelegate class]));
}
}
In iOS, there's a uiapplicationmain inside the main method with 4 parameters.
Param 1:ARGC: Number of parameters corresponding to argv
param 2:argv: Parameter variable list (load-info.plist file information for application)
Param 3: Specifies the name of the UIApplication class or subclass. If nil is the default is UIApplication
PARAM 4: Sets the proxy object for the application. If nil, the proxy object is loaded from the application's main nib file.
Return value: This method generally does not return, even if the user clicked on the iOS home button, the program will move it into the background.
The Uiapplicationmain function returns when the program exits normally
When the program starts, it will come to Appdelegate, which inherits Uiresponder and follows the Uiapplicationdelegate
Uiresponder: Defines the interface for responding to and handling events, which is the parent class of UIApplication, UIWindow, UIView to receive user motion events and touch events
Program Start complete
(BOOL) Application: (UIApplication *) Applicationdidfinishlaunchingwithoptions: (Nsdictionary *) launchOptions
Program loses intersection
(void) Applicationwillresignactive: (uiapplication *) application
program into the background
(void) Applicationdidenterbackground: (uiapplication *) application
Procedures to enter the foreground
(void) Applicationwillenterforeground: (uiapplication *) application
Program Get focus
(void) Applicationdidbecomeactive: (uiapplication *) application
The program is about to close
(void) Applicationwillterminate: (uiapplication *) application
If the program does not set the primary startup storyboard file, and there is no
(BOOL) Application: (UIApplication *) Applicationdidfinishlaunchingwithoptions: (Nsdictionary *) launchOptions
method to set the Window object is not normal activity
Typically set in this method
(BOOL) Application: (UIApplication *) Applicationdidfinishlaunchingwithoptions: (Nsdictionary *) launchOptions
{
Self.window = [[Uiwindowalloc]initwithframe:[[uiscreenmainscreen]bounds]];
Self.window.backgroundColor = [Uicolorwhitecolor];
Self.viewcontroller =[[viewcontroller alloc] initwithnibname:@ "Viewcontroller" bundle:nil];
Setting the root View Controller
Self.window.rootViewController =self.viewcontroller;
Set the main view and the visible window has only one main view
[Self.windowmakekeyandvisible];
}
Now that you have the Window object, you can add a variety of view to customize the interface.
Otherwise, no window object can see any UI interface