Greg
Greg

Reputation: 34818

iPhone development and use of separate model files?

I've read a lot about MVC as I'm ramping up with iPhone / IOS development. However in the various sample files I've see so far I'm not really seeing separate classes for model, view & controller?

How should I concretely see MVC in action with a best practice developed iPhone application? For example perhaps one based on a NavigationController & some Table Views etc.

For example:

Hope this makes sense...

Upvotes: 2

Views: 310

Answers (1)

Bogatyr
Bogatyr

Reputation: 19333

You'll be following MVC by using the objects and tools in their typical use. A UIView object is used to present data and receive input (View). A UIViewController responds to events and routes the data back and forth between the data model and the UIView hierarchy (Controller). Your data model lives wherever you want it to, sometimes composited together with your UIViewController subclass, sometimes present in the app as a singleton class (Model). When you specify your shared data model as a singleton class then any class that needs it can access it from anywhere in the app. By maintaining this division of labor, your application will tend to be well-organized and modular, and you can maintain/extend one aspect without having to rewrite all the other aspects of the program.

Interface builder is a tool for visually building the view hierarchy (and to some extent the control hierarchy) of your application.

Upvotes: 2

Related Questions