IPhoneApplicationsEventProcessing andPackageThe structure is described in this article. EventProcessing cycles andIPhone packageStructure.
Event processing cycle
After the UIApplicationMain processing program is initialized, it will enable the time-out loop and screen-drawing loop. The process is as follows:
When a user interacts with an iPhone device, the iPhone OS detects a touch event and puts it in the event queue. The UIApplication object responsible for event processing extracts the event from the top of the queue each time and passes it to the object most suitable for processing it. For example, the click event on the button will be passed to the corresponding button object. The time can also be passed to the Controller or other objects that are not directly processing the modification event.
In the iPhone OS Multi-Touch event model, the Touch data is encapsulated into a separate event object (UIEvent ). to track a touch, the event object contains several touch objects (UITouch), each of which represents the touch of a finger on the screen. When you move your finger to the screen and finally exit the screen, the system submits the changes of each finger to the corresponding touch object.
When a program is started, the system creates a process and a separate thread for the program. This initial thread will become the main thread of the program. UIApplication starts the main loop and configures the program's event processing code here. Shows the relationship between the event processing code and the main thread,
The Touch event is added to the end of the queue by the system until it is processed by the main loop of the program.
IPhone Package Structure
When buildingIPhoneXcode will pack the program into a package. This package is a directory in the file system used to put related resources together. OneIPhone packageIncluding various resources used by executable programs and programs (such as program icons and otherImageAnd local resources ). Let's take a look at it one by one.IPhone packageWhat exactly does it have?
MyApp
Stores executable files of program code. The file name is the same as the project name. This file is required.
Settings. bundle
Settings. bundle is a set of packages like the Settings Application that adds the setting options. This file package contains a list of attributes and other resources for setting and implementing attributes.
Icon.png
Icon.png is a png Image of 57*57. It is used as a program icon on the iPhone's main interface to represent your program. This image does not require additional effects. The system automatically adds these effects. This file is required.
Icon-Setting.png
The Icon-Setting.png is a 29*29 png image used as an icon in the setup program to represent your program. If your program has Settings. bundle, this icon is displayed next to the program name. If you do not set this image, the system will scale icon.png instead.
MainWindow. nib
MainWindow. nib is saved as the default Interface object to be loaded when the program starts. In general, MainWindow. nib stores the instance of the Main Window object of the program and the proxy object of the program. Other interface objects are either loaded from other. nib files or implemented through code programming.
Default.png
Default.png is a 480*320 png.ImageIt is used for display when the program is started. At startup, the system will use thisImageAs a temporary background until the program loads its window and user interface.
ITunesArtwork
This is a 512*512 icon for those programs sold in ad-hoc mode. In general, this icon is provided by the App Store, because the software that is distributed in ad-hoc mode does not pass the App Store, but it must be re-displayed in the program. ITunes uses this icon to display your software. (This oneImageMust matchImage(In jpg or png format. The file name must be iTunesArtwork and cannot have a suffix .)
Info. plist
Info. plist is the information property list of the program. This file defines attributes of a program in the form of key-value, such as Bundle ID, version number, and display name.
Other resource files
Non-localized resources are placed at the top of the package. The program can use non-localized resources freely regardless of the language selected by the user.
*. Lproj language directory
Localization resources are put in a directory written in a ISO639-1 language with A. lproj suffix (for example, en. proj, fr. proj stores localization resources related to English and French ).
Summary: DetailsIPhoneApplicationsEventProcessing andPackageThe structure has been introduced, and I hope this article will help you!