Custom UITableViewController does not load static cells

I experimented with static cells, so I made a tabular view and nested in it UITableViewController, and then added some static cells. Everything worked fine until I created a new class UITableViewControllerand connected it as a user class before the interface constructor. Since when I create the application, it just shows an empty Tableview without any cells in it, and now I'm wondering what I am missing.

I have tried some research, I doubt that I will be the first to ask, but apparently I must have been looking for the wrong thing. I suppose there must be something that goes on ViewDidLoad, so are static cells loading?

+5
source share
3 answers

Here is the solution:

Remove the following methods from the .m file:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
} 
+11
source

If you use a template UITableViewController, it probably created a lot of skeletons for you UITableViewDelegateand UITableViewDataSource. When you use a Storyboard with static cells, you should not use these methods; just delete them from your controller.

0
source

What did Hans say. Also, make sure you subclass the UITableViewController, that these methods are also removed from this.

0
source

All Articles