Can a view be managed by 2 view controllers? An example is the Root View controller has a Table View Controller inside it, The view of both these controllers is the table view. With this configuration the app loads but crashes during run-time where you scroll the table view. Whats wrong here?
A:
Each UIViewController manages a single view and it's subviews. It is not advisable to try to manage a single view with 2 view controllers.
The problem is that you do not need 2 view controllers here. Your root view controller should be a custom subclass of UIViewController. Add a UITableView as a subview of the root viewcontroller's view and set the UITableView's delegate and datasource to the root view controller. Ensure that your root view controller class implements the required methods of the UITableViewDatasource protocol you can do this in interface builder or programmatically in the viewDidLoad method of your root view controller.
It is also possible to use a UITableViewController as the root view controller directly
Blueneon
2010-07-11 03:48:35