Original articles, welcome reprint. Reprint Please specify: Dongsheng's Blog
The MVC (Model-view-controller, model-View-Controller) pattern is one of the very old design patterns that first appeared in the Smalltalk language. Today, many computer languages and architectures use the MVC pattern.
MVC Mode Overview
The MVC pattern is a composite design pattern, consisting of the observer (Observer) pattern, the Strategy (strategy) mode, and the composition (Composite) pattern. The MVC pattern consists of 3 parts, and the 3 parts are shown below.
- Model. Save the status of the app data, respond to the view's status queries, process the application business logic, complete the application's functionality, and notify the view of changes in state.
- View. Present information to the user and provide an interface. The user makes an action request through the view to the controller, and then makes a request for the query state to the model, and the change in the model State is notified to the view.
- Controller. Receives a user request and updates the model on request. In addition, the controller updates the selected view as a response to the user's request. The controller is the medium of the view and the model, can reduce the coupling degree of the view and the model, make the view and the model's responsibility more clear, thus improves the development efficiency.
Corresponding to the "content" and "form" in philosophy, in the MVC model, the pattern is "content", it stores the data that the view needs, the view is "form", is the external expression way, and the controller is their medium.
Cocoa Touch in the MVC Mode
We're talking about the generic MVC pattern, and the MVC pattern in the cocoa and cocoa touch frameworks is slightly different from the traditional MVC pattern, where the model doesn't communicate with the view, and all communication is done through the controller.
In the Uikit framework of the cocoa Touch Framework, Uiviewcontroller is the root class for all controllers, such as Uitableviewcontroller, Uitabbarcontroller and Uinavigationcontroller. UIView is the root class for views and controls.
Welcome to follow Dongsheng Sina Weibo @tony_ Dongsheng.
Learn about the latest technical articles, books, tutorials and information on the public platform of the smart Jie classroom
?
More Products iOS, Cocos, mobile design courses please pay attention to the official website of Chi Jie Classroom: http://www.zhijieketang.com
Luxgen Classroom Forum Website: http://51work6.com/forum.php
Learn note from the start of the zero (Day67)--cocoa Touch design mode and application MVC mode