0

In the master-detail application template for iPad in XCode 4.3, the master view (side pane navigation menu) extends a UITableViewController. I instead want it extend a UIViewController and make use of UIView & a UITableView to show the master table (here's why!).

The problem I am facing is that I can't drag & drop a View object onto MasterViewController class (which extends UIViewController). Can't this be done using the interface builder? The best I have been able to do is drag/drop the UIView at same level of MasterViewController not inside it. Am I missing something here?

Community
  • 1
  • 1
vikmalhotra
  • 9,981
  • 20
  • 97
  • 137

1 Answers1

4

To replace the standard table view controller with a view controller in the default application, do this:

  1. Select the master UITableViewController
  2. Press delete to delete it.
  3. Drag a UIViewController from the Objects panel onto the canvas.
  4. control-drag from the master navigation controller to the new UIViewController
  5. Select "Relationship - Root View Controller".

Note: In your other post you said that you want to combine a UIView and a UITableViewController. Just a word of warning: If you are using static cells in the table view, it must be embedded in a UITableViewController and it will not work in a UIViewController. (You must use dynamic cells if you are going to do it this way). In your particular case, you may not need the table view at all though.

lnafziger
  • 25,760
  • 8
  • 60
  • 101
  • @Inafziger Nice! You answered the question a bit too general though (replacing the controllers). Had to do a bunch of other things for the template to work with a custom master view, like removing the code that handles the tableView. Thanks – pnizzle Jul 10 '12 at 05:41