2015-04-14
Yesterday I installed Xcode, and today I started to touch the basics of OC and iOS:
- iOS based OS X same Mach kernel
- The IOS app is supported by the following technical levels:
- Cocoa Touch
- Media
- Core Services
- Core OS
Core OS and core services provide the underlying support, including file access, network protocols, low-level data types, bonjour services, and more. They are C-based interfaces, including APIs such as Core Foundation,cfnetwork,sqlite
The media layer provides basic support for 2D, 3D graphics, sound, and video technology. Includes C-based OpenGL Es,quartz,core Audio, and Objective-c-based Core animation.
The Cocoa touch layer includes most APIs that use objective-c, consisting primarily of foundation and Uikit two frameworks, which provide object-oriented file access, network operations, data/collection types, and more. Uikit provides classes such as the main UI controls and controllers in the app.
These levels of technology should be used from top to bottom when developing iOS apps.
The Cocoa Touch layer provides basic system behavior support, minimizing the effort. When you want to implement more complex behaviors and interfaces, consider seeking technical support for the lower layers.
APP Core structure
Apps from open to exit are all Uikit frameworks that manage most of the underlying mechanisms. It provides some of the key objects that the program needs to run, allowing the app to capture user input and display content on the screen. Uikit uses the unique UIApplication object of each app to accept input from user objects, while feedback on user input is part of what our code should do.
App life cycle
- Start (Launch)
- Events Loop (event loop)
- Termination (termination)
Event processing Cycle
Capture event, wrapping event (uievent), handling events, feedback display
Handling events in the main loop: The system captures events, passes events to the objects that can respond, responds to object handling events or passes events, and discards if the event is not handled:
App Sandbox for security reasons, iOS strictly stores individual apps in a separate location in the file system, a mechanism known as sandbox (sandbox). In this way, each app's files are securely stored and other apps cannot access them. The app is also unable to access the file system outside the sandbox, including system files. During the app installation process, the system generates its home directory and some key subdirectories for each app, usually in the following path:
/applicationroot/applicationid/
App Pack (Application bundle)
When compiling the app, Xcode organizes it into a bundle. The app package is a directory in the file system that centralizes all relevant files in one place. The app package includes the app's executable files and resource files.
Typical components of the app package:
- Myapp.app executable file
- Icon.png app icon
- mainwidow.nib main Window Xib file
- Default.png Load-time picture
- Itunesartwork itunes Pictures
- Info.plist configuration file
- Resource Files Resource File
Info.plist:
Restriction conditions
- Display area
- Minimal and compact interface elements
- Interactive controls that are large enough
- File size
- Limited storage space
- Download time and cost
- Resource Load Speed
- Memory space
- 128M, less program run space
- Memory Management and optimization
- Avoid high-quality pictures and audio
- Operating limits
- Only one foreground program at a time
- Programs that do not develop background running
- Program run time must not exceed 5 seconds
- Data access
- You cannot use a static class library in another app
- Cannot access any files other than the sandbox, nor can I share the files in the sandbox
- Some system resources, libraries, address books, etc. can be accessed through a specific API
- Access network resources When you have network links
- Energy consumption
- CPU Load
- Fever, battery consumption too fast
- Algorithm optimization
- User usage habits
- Quick Start, short use
- May exit at any time
- Avoid unnecessary "help"
- Auto Save
Hello,there App
1.Create a new Xcode project:
2.Single View Application
3.Options for new project:
4. Select the project storage path and generate the following project structure:
5. Then edit the Main.storyboard (storyboard?). ), select Viewcontroller
6. Drag the Lable object to the Main.storyboard above, double-click to edit, change to the text we need to
Operating effect:
iOS Learning Notes