UITableViewController inside a UIViewController

You'll want to use an embedded container view.

  1. Drag a "Container View" from Interface Builder sidebar into the view. This adds and links a default "contained" UIView/Controller as well.

  2. Delete the entire UIViewController and View that was automatically added and linked to the container view (as you'll want a Table View Controller instead).

  3. Drag a UITableViewController onto the Storyboard canvas.

  4. Control-Drag from the Container View to the Table View Controller. Select "Embed" to contain the UITableView within the container view.

You're left with the parent view, now containing a UITableView via a Container View. The Controller for the Table View is on the storyboard canvas as well.

Table View Controller inside a Container View


You can make that table view controller a child view controller of your UIViewController.

In the storyboard, you can do this easily by dragging a container view into your controller's view, and that will give you a child view controller automatically.

You'll want to:

  • delete the child view controller it gives you (it's just a UIViewController)
  • drag out a table view controller
  • control drag from the container view to the table view controller
  • choose "embed".

If you need to get a reference to this table view controller from the UIViewController, you can do that in prepareForSegue -- the table view controller will be the segue's destination view controller, and prepareForSegue will be called right after the controllers are instantiated.