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.