Question

I'm implementing a datasource object for an UIScrollView. Is that part of the Controller, or part of the Model? I think Controller, but not sure. It delivers the data. But the data could be in sqlite3, files, from the net. So actually I would say it's not from the Data part, since it should be flexible to from where the data comes. What do you think?

Was it helpful?

Solution

The data source for any visual control should be your controller. Your controller should get/process the data from the Model and then hand it off to the view.

OTHER TIPS

I would say it is actually neither. Your UIScrollView datasource is simply formatting your data for display.

Unless you have specific actions that perform "business logic", your UIScrollView datasource participates in the View.

The Controller would include logic that modifies or processes data in any way, your scrollview simply allows the data to be displayed.

Cocoa's MVC paradigm encourages both "model controller" and "view controller" objects. The data source object falls in the view controller category; it requests model objects from the data store depending on what UI element needs them, reformats the data a bit to fit , and passes it on to the UI. Usually the same object will also handle UI events and delegate methods.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top