in mvc design pattern who represents model,view, controller?
I am not sure of which represents model,view and controller. If i take an example of a tablecontroller based app can i say tableview (xib) is the view and the model(some other .m fil开发者_开发知识库e with data for this tablecell) ? and the controller is the .m file ?
I took this image from this apple's link
Model, view, and controller are three different roles that objects can play in an application.
Model objects are those which store data and, often, logic that relates the different pieces of data to each other. When a user does something meaningful in an application, he or she is often making some sort of change to the model objects.
Objects in the 'view' role make up the application's interface to the outside world. The user interacts with view objects. View objects know how to display information and collect user input, but they don't make any decisions about what to do with the data.
Controllers mediate between the other two kinds of objects. If an app needs to display some data, the controller retrieves the data from the model object(s) and gives it to view objects to display. When the user causes some action to happen (say, they press a button), the controller decides how to respond.
All three kinds of objects (and all other objects) are defined in code at some level, either in your own source code files or in OS-provided frameworks. Whether the objects themselves are instantiated in code or loaded from a .xib file makes no difference in the role they play.
The below link is an excellent tutorial on the design and creation of a small iPhone app. Towards the end of the tutorial the author interprets and explains the app in relation to model-view-controller design.
The design of an iPhone application
精彩评论