I recently looked at the MVC pattern and wanted to apply it to iPhone development. However, there seem to be so many variations on the template that I'm not sure exactly how it should be applied.
As I understand it, the view will notify the controller of any actions that have been performed, and the controller, in turn, will update the data model (if necessary). The data model will notify the view whenever a data change occurs, and the view then updates its display accordingly.
In this basic model, the controller has only knowledge of the data model. However, I cannot figure out how to use this design in my iPhone application.
On the next page, an alternative version of the template is proposed, in which the controller has an idea of the data model and presentation, and all communication between the model and the representation is done through the controller. It also appears that the model and view have access to the controller. Will I be right in suggesting that the data model interacts with the controller through some form of notification (notifications or KVO) and that the view interacts with the controller through actions?
Is this second model correct?
http://www.bogotobogo.com/DesignPatterns/mvc_model_view_controller_pattern.html
Many thanks,
Danny
Danny source
share