Basic iOS Design Model

Source: Internet
Author: User

No matter which type of iOS application is created, you must know several basic design patterns and technologies before writing code. In IOS, the system framework provides the most important infrastructure for applications. In most cases, the underlying hardware can only be called through the system framework. In turn, the framework also uses many special design patterns. Before developing an application, we assume that you are familiar with these design patterns. To know how the system supports applications, you must first understand these design patterns, which is very important.

The most important design patterns you must know:

Model-View-Controller-this design mode is the main architecture of IOS apps: Model-View-Controller (MVC) mode divides your code into several independent parts. The model part defines the data engine of the application and maintains data integrity. The view part defines the user interface of the application and does not have a clear understanding of the data source displayed on the user interface; the Controller part serves as a bridge between the model and the Controller to help update data and display.

Delegation-this design pattern facilitates the data transmission of an object to another object: The delegate pattern can modify complex objects without subclass. Unlike subclass, you can use complex objects as usual, and place the custom code that modifies the behavior in another object, which is called a delegate object. Complex objects need to call the delegate object method at predefined time points so that they have the opportunity to run custom code.

Delegation is implemented through protocol.

Target-action-this design mode uses buttons to convert user interaction into code, allowing the program to execute: the control notifies your application of user interaction in the target-action mode. When a user interacts in a predefined manner (such as clicking a button), the control sends messages (Actions) to the specified object (target ). After receiving the action message, the target object will respond in an appropriate way (for example, updating the application status when pressing the button ).

Block objects ---- use blocks to implement callback and Asynchronization

Sandboxing --- all iOS applications are placed in a sandbox to protect the security of other applications and systems. The structure of sandbox affects application file placement and data backup. It also affects some functions of other programs. For security reasons, iPhone OS limits each application (including its preference settings and data) to a specific location in the file system. This restriction is part of the security feature called the "sandbox" of the application ". Sandbox is a set of fine-grained controls used to restrict applications from accessing files, preferences, network resources, and hardware. In iPhone OS, applications and their data reside in a safe place, and other applications cannot access them. After the application is installed, the system obtains an opaque identifier through computation, and then constructs a path pointing to the application home directory based on the root directory and identifier of the application. Therefore, the home directory of the application has the following structure:
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.