daspianist
daspianist

Reputation: 5525

Cell content in a static tableview not showing

I have a regular ViewController in which I have added a tableView that occupies a small portion of screen (as seen below). Because my tableView is static, I have not implemented any of the Tableview datasource methods as recommended in the answer here. However, the content that I have put in in Storyboard is not showing up, and I am at a loss as to what else could be going on.

To illustrate, the below is what I have set up in Storyboard:

enter image description here

But this is is what shows in the simulator:

enter image description here

I have set self.tableview.delegate = self in viewDidLoad, as well as declaring my view controller to be a <UITableViewDelegate>. However, none of this has helped.

Upvotes: 1

Views: 4924

Answers (1)

Danchoys
Danchoys

Reputation: 739

Static cells work only with UITableViewControllers. They serve as a data source for the table view and are responsible for providing it with all those rows you nicely set up it the Interface Buider. I usually use a Container View in such situations. It is a view which displays the another view controller's view inside it. In your case this 'another controller' is a UITableViewController or the one, derived from it.

enter image description here

Upvotes: 6

Related Questions