MVC design question

Discussion in 'iOS Programming' started by blue-lion, Mar 16, 2012.

Thread Status:
Not open for further replies.
  1. blue-lion macrumors member

    Joined:
    Jan 26, 2010
    #1
    Wirelessly posted (Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B176 Safari/7534.48.3)

    Hi. I have a question regarding the MVC design concept. In most diagrams I have seen ( including material from the stamford lectures) there is no allowance for data to be passed back from the model to the controller. And yet data has to be passed back in order to be passed to  a view,right?. Or maybe I'm mistaking data for communication? 

    I have a private model object declared in my main controller as per recommended in the lectures ,but surely  the results have to be fed back from the model to the view(via the controller)?
     
  2. amorya macrumors 6502

    Joined:
    Jun 17, 2007
    #2
    Probably what the diagrams are getting at is that the model shouldn't initiate talking to the controller. It can most certainly respond to queries, and you're right, that's the only way you can get data into a view!
     
  3. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
  4. Sykte macrumors regular

    Joined:
    Aug 26, 2010
    #5
    Easiest way to think of this is the follow.

    Your controller can have a direct association (ownership) of a model or view.

    Your view can have a direct association (ownership) to your model and have indirect association (weak link) to your controller.

    Your model never directly associations (ownership) with either the controller or view, it can however have an indirect association (weak link, or think observer) with the view or controller.
     
Thread Status:
Not open for further replies.

Share This Page