iOS common design mode--MVC mode (iOS development)

Source: Internet
Author: User

In the MVC pattern in Cocoa touch, models and views cannot communicate, and all communications are controller-complete.

-Model: is a special object, essentially a view of the data, text field input content, button on the label is a model, not necessarily to create a model class.

-View: UIView, which is relatively easy to understand, sends a request to the controller.

-Controller: Update the view as a response to a user request to update the model's data.

The model is the data, the view is an interface, the controller is the middle of the update medium.


1, Touch mybutton time, will trigger method.

2, the view controller implements a number of delegates and data source protocol.

3. The view controller changes the view by altering the properties.

4. The model object notifies the data change by notification and KVO mechanism. (not in this case)

5. The view controller can save a model member variable and attribute, thus changing the model state. (not in this case)


Because this example does not involve a view model, the 4 and 5 processes need to be understood repeatedly.

iOS common design mode--MVC mode (iOS development)

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.