1

i'm working with segues and i want to transition from one view to another when i press the addButton uiBarbutton object. Anyway, i added a table view object from the objects library under the inspector and i changed the table's style to grouped and changed the cells to be static. when i run the app everything works fine as long as the table view object is a subclass of UITableViewController. when i change the class of the table in inspector to a class i made (also subclasses UITableViewController) the cells don't appear in the simulator as before. is there anything i should be adding to the prepareForSegue:sender method ?

user1938695
  • 623
  • 1
  • 5
  • 14
  • YYUP i found the answer in the the post you provided in one of the comments. however my problem isn't the same as the one in the post. Thanks anyway. i'll post the answer here so that if somebody came across this post he will get the answer. – user1938695 Mar 04 '13 at 15:23

2 Answers2

3

when using a table view with a class you created plus being group styled and static cells, make sure you don't implement the following:

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

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

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { }

erase them all!

user1938695
  • 623
  • 1
  • 5
  • 14
0

The answer is, read the documentation! In the document "About Table Views in iOS Apps", there is this note:

"Note: If a table view in a storyboard is static, the custom subclass of UITableViewController that contains the table view should not implement the data source protocol. Instead, the table view controller should use its viewDidLoad method to populate the table view’s data. For more information, see “Populating a Static Table View With Data.”

rdelmar
  • 103,982
  • 12
  • 207
  • 218