Static table view outside UITableViewController

Francesco S picture Francesco S · Mar 12, 2014 · Viewed 69.4k times · Source

After the new Xcode update, my app doesn't validate and shows this error:

static table views are only valid when embedded in UITableViewController instances

Any chances to solve easily?

Answer

LukeSideWalker picture LukeSideWalker · Aug 8, 2014

The only way to get a static UITableView along with other controls on the same screen is to use a Container View. Follow this way, it works perfectly:

  1. Drag a ViewController onto your storyboard.
  2. Drag a TableViewController onto your storyboard.
  3. Next Drag a Container view to your ViewController and size it about the size you want (smaller than the view) -> when you drag the container view it will create a segue and another view. Remove that segue and view.
  4. Then finally ctrl click in your container and drag to your new TableViewContoller. Select Embed.
  5. Style your TableView the way you want -> including static cells.

Good luck.

This answer was already found and given here: G.Huebner -> http://web.archive.org/web/20140928102504/http://iphonedevsdk.com/forum/iphone-sdk-development/111800-static-table-view-cells-only-work-in-a-uitableviewcontroller.html