0
votes

I have a UIViewController with a table view in it. In my storyboard, I just dragged a generic table view element into this controller view, and set its content to be static cells. And I make several sections in the table view, and each section is filled with my buttons, text fields and other controls. But when I segue to this controller, it's crashed at:

return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

Before I added the table view with static cell, there is no error. And I searched some of the similar problems, and changed the controller's super class to be UITableViewController, but I didn't implement the

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

delegate, since I think there is no need to implement that if using static cells. Does anybody know what is the problem?And how to fix that.


I solved this problem by dragging a whole UItableViewController in my story board, and copied my controls into this new view controller. It looks like dragging a table view won't work with static cell.

1
in fact,I have set the Exception point,but the error goes right to the above code - David Hx
So does it work when the table is in a UITAbleViewController? As far as I know, tables with static cells need to be in a UITableViewController (unless that has changed in iOS 7). - rdelmar
I'm developing iOS7 and it doesn't work when I changed to the UITableViewController as I mentioned in my post. - David Hx
You should post your code for the controller with the table view. - rdelmar

1 Answers

0
votes

I found a nice explanation for this here

http://useyourloaf.com/blog/2012/05/07/static-table-views-with-storyboards.html

Basically, when using static cells, the table view do not have them dequewed... because they were created in interface builder. So, it appears that if you call [super tableView:tableView cellForRowAtIndexPath:indexPath]; it will return it from the IB.