objective c - KVO and MVC Question -


simple question here... alright in terms of mvc design observe value in model view (using key-value observing), , update view's current location on screen based on when model's variable changes?

is okay observe view object , have object move when location variable inside of model object changes?

or against mvc because view , model communicating in sense?

you should tie through c, controller, item. if means you're pulling in state data model, , having controller set view or view read data controller.

the view , model should separated controller. that's mvc according apple. reason right may straightforward have view reference model's state - model change in future, , you'd stuck updating view, when there's no reason view should impacted. , model should never update view's position - should not have idea of details of display. that's job of controller, control views , move them around based on model data.

think way: view should know how display things or interact user i/o, model should know business logic data comes in on interface of inputs , outputs. should able run model without view existing, instead should able have unit test type code feeds inputs , outputs. moving view around out of responsibilities of model.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -