I have read in multiple places that only one UIViewController
should be on screen at a time. But I don't quite understand how to accomplish what I need otherwise.
Imagine the weather app. There is a single view controller with a scroll view, to which multiple views are added (the weather panels). Presumably these are all added and managed by the main UIViewController
, which is also responsible for scrolling, etc.
But imagine each of those weather panels was instead a CarView
, each with data about a specific type of car, and some controls to edit that data.
Wouldn't it make sense to have a series of CarViewControllers
, each with a Car
property that they can manipulate? Each CarViewController
would be responsible for it's car data object, it's view, and glueing them together, and the main view controller would simply be responsible for adding each carViewController.view
to its scrollview.
Isn't this better for re-usability and encapsulation? Not to mention more convenient.