Static table view outside UITableViewController

IosIphoneXcodeCocoa Touch

Ios Problem Overview


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?

Ios Solutions


Solution 1 - Ios

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

Solution 2 - Ios

A static UITableView must be in a UITableViewController. So you will have place the table in UITableViewController and then add it as childView to the MainViewController.

You can refer https://iphoneidoit.blogspot.in/2013/10/static-uitableview-in-uiviewcontroller.html

Solution 3 - Ios

I think what you are doing is you are first dragging the ViewController on the storyboard and then dragging the tableView on the ViewController. In this way you can't use the Static table cells. Instead of this what you should have done is Drag the TableViewController on the main storyboard instead of a ViewController and then select the static cells. In this way you can be able to work on static cells and can use any elements on static cells.

Solution 4 - Ios

Well, if you are really using a static tableView, you should consider copy/past everything to a ScrollView or StackView.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFrancesco SView Question on Stackoverflow
Solution 1 - IosLukeSideWalkerView Answer on Stackoverflow
Solution 2 - IosSahana KiniView Answer on Stackoverflow
Solution 3 - IoshellosheikhView Answer on Stackoverflow
Solution 4 - IosRiver2202View Answer on Stackoverflow