IOS cainiao growth notes (3)-Stanford Open Course (1), ios Stanford

Source: Internet
Author: User

IOS cainiao growth notes (3)-Stanford Open Course (1), ios Stanford
I. layer-4 Structure of iOS


1. Core OS

It is a Darwin written by FreeBSD and Mach, and is a Unix core that is open source and complies with POSIX standards. This layer includes or provides some basic functions of the entire iPhone OS, such as hardware drivers, memory management, program management, thread management (POSIX), file system, network (BSD Socket), standard input and output, etc. All these functions are provided through the C language API. In addition, it is worth noting that this layer has the most UNIX color. If you need to port the programs developed on UNIX to the iPhone, most of them will use the Core OS API.

2. Core Service

Core Services provides richer functions based on Core OS, including Foundation. framework and Core Foundation. framework is called Foundation because it provides a series of basic functions to process strings, arrange, combine, calendar, and time. Foundation is an API of Objective-C, and Core Fundation is an API of C. In addition, Core servieces provides other functions, such as Security, Core Location, SQLite, and Address Book. among them, Security is used to process authentication, password management, and Security management; Core Location is used to process GPS positioning; SQLLite is a lightweight database, while AddressBook is used to process phone thin data.

3. Media

Like its name, the Media layer provides multimedia functions such as images, music, and videos. Images are divided into 2D images and 3D images. The former is supported by Quartz2D, while the latter uses OpenglES. the modules corresponding to music are Core Audio and OpenAL. Media Player enables video playback and finally provides Core Animation for powerful Animation support.

4. Cocoa Touch

The top layer is Cocoa Touch, which is the Objective-c api, and the core part is UIKit. framework, a variety of components on the application interface, all provided by it, in addition to it is responsible for processing the screen multi-point touch events, text output, pictures, webpage display, access to cameras or files, and accelerated sensing.

Ii. MVC in iOS


As shown in, we divide it into three parts. The white split lines indicate direct access, and the yellow split lines indicate direct access.

To access the attributes in a view's UIView, you need to use Outlet for direct access. If the view has certain events (such as clicking or sliding), you need to notify the Controller) you need to use action or delegate for access, and the data changes of the Model are broadcast to notify the Controller.

Iii. Key points and notes of Objective-C

Create a new Card class that contains two files (Card. h file and Card. m file)

** Card. h is a public declaration, and Card. m is a private implementation.


As shown in, private declarations can be made in the Card. m file.

** The dot syntax is only applicable to getter and setter methods. (Other methods that return void values only have syntax warnings, but it is not recommended)

** The difference between Objective-C and Java is that attributes cannot be accessed directly through the dot syntax (the dot syntax actually calls the getter and setter methods)

For other syntaxes, see Objective-C basic notes.

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.