Architecture Analysis of IOS applications

Source: Internet
Author: User

First, create an IOS application project. The main file structure is described as follows: main. m XXXXDelegete. h \. m MainWindow. xib info. plist. the IOS application is encapsulated by UIKit,

 

IOS applications are encapsulated by uikit and implemented by the main function of an Application:

Int main ()

{

 

NSAID utoreleasepool * pool = [[NSAID utoreleasepool alloc] init];
Int retVal = UIApplicationMain (argc, argv, nil, nil );
[Pool release];
Return retVal
 

}

 

Among them, the NSAID utorelaeasepool will automatically release the memory, and the autorelease will suspend the release operation.

The core is the UIApplicationMain () function. The UIKit encapsulates the initialization work, loads the user interface of the application, and starts the event loop. The 3rd 4th parameter receives the NSString * type parameter, which is used to specify the class name.

The UIApplication class is specified with 3rd parameters. If the value of the first class string is nil UIKit, The UIApplication class is used by default. If it is not null, the application will specify the custom subclass of the UIApplication class,

AppDelegate. If the application delegate class is nil, UIKit will master the application nib file (for Applications created using Xcode templates) assume that an object in is the delegate object of the application.

 

 

UIApplication and Appdelagate

 

UIApplication is the core of an App. He/she is responsible for event processing logic and the FirstResponder corresponding to the App-related events such as touch screen processing, the related operations are notified downward through AppDelegate. UIApplication is the core of any application. It uses AppDelegate to generate different action actions for different programs.

Master nib file

The default value is MainWindow. xib, which is specified by NSMainNibFile in * info. plist. If the information property list (Info. plist) file of the application contains the NSMainNibFile key, the UIApplication object will load the nib file specified by the key as part of the initialization process. The primary nib file is the only nib file automatically loaded. Other nib files can be loaded later as needed.

The primary nib file of an iPhone application usually contains a window object and an application delegate object. It may also contain other important objects of one or more management windows. Loading a nib file will re-construct the objects in the file and convert the disk representation of each object into memory objects that can be operated by the application. There is no difference between the objects loaded from the nib file and the objects created by programming. However, for the user Interface, it is graphically (using the Interface Builder program) creating and storing the objects associated with the user interface in nib files is usually easier than creating them programmatically.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.