IOS: MVC

Source: Internet
Author: User

I saw the introduction of the MVC model in Stanford when I first started learning Ios. However, I did not have a deep understanding of it because I was a beginner or an English speaker. Now I find that some good people in China have translated Chinese for that period, and I have some experience. Then I can go back and have a deep understanding.

Http://v.youku.com/v_show/id_XNTI4Mzc5NDQw.html

Summary:

1. Basic Concepts

Model :"What your app is (but not how it is displayed) "mainlyProgramThe basic data object, such as the pure card and game logic in the bridge game as an example in the video. Save data. It has nothing to do with the UI.

Controller:"How your model is presented to the user (ui logic)" is responsible for UI logic and displays the UI.

View:"App's minions" Controller toys. For example, buttons, Slider, and other common high-reuse controls.

2. Communication

.

, The white dotted line indicates that the data can pass through directly, the yellow indicates that the data cannot pass through communication, and the white solid line indicates that the data can pass through indirectly.

First, the controller can communicate with the model and view at will. The Controller is responsible for displaying the model content to the UI, So C can call all M APIs. C can also communicate with V through outlet.

Model and view cannot communicate.

View ---> controller:

Three methods. 1. Action in the view, target in the Controller; 2. Delegate (shocould Will did) through the Protocol; 3. Data Source, Special DelegateView itself does not store data

Model ----> controller:Uncommon. For example, database update notification C updates the UI. Mainly through radio station broadcast (notification & KVO)

3. MVCs

The module is divided into MVC, and the sub-MVC can be the view in other MVC.

For example, the lower-right corner of the page is the MVC of each tab page. They all belong to the view of navigation MVC above.

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.