Friday, October 11, 2013

Static UITableView in UIViewController



A static UITableView must be in a UITableViewController.  If the tableview is not in a UITableViewController, the table cells will simply be blank.

A UITableViewController also cannot be placed within another view controller.

The only way to get a static UITableView along with other controls on the same screen is to use a Container View.

As GHuebner writes:
Drag a ViewController onto your storyboard. Drag a TableViewController onto your storyboard.  Next Drag a Container view to your ViewController and size it about 1/2 of the view. When you drag the container view it will create a segue and another view. Remove that segue and view and then ctrl click in your container and drag to your new TableViewContoller. Select Embed.


http://iphonedevsdk.com/forum/iphone-sdk-development/111800-static-table-view-cells-only-work-in-a-uitableviewcontroller.html

To actually use the static UITableView in your code it seems a bit more complicated:
http://iphonedevsdk.com/forum/iphone-sdk-tutorials/111816-using-static-table-views-in-ios-6-using-embed-segues.html#latest

I think I'll just stick with a static array and use a dynamic UITableView.

No comments:

Post a Comment