Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nashyo

macrumors 6502
Original poster
Oct 1, 2010
299
0
Bristol
How can I make a table view behave normally when embedded in a UIViewController - (Not UITableViewController?)

I have discovered that it is impossible to have static table cells when adding the tableview as a subview of a view in a UIViewController. This is only possible in UITableView Controllers.

So I have set the tableview cells as dynamic and given them a 'group' style. My datasource is a simple array of dictionaries resulting in three rows (1 section only). This is working fine when setting the value of prototype cells = 1 in storyboard. If there are more than 1 prototype cells in storyboard, I receive the following error:

Error
Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:], /SourceCache/UIKit_Sim/UIKit-1914.84/UITableView.m:4118
2012-04-25 13:31:12.530 Design3RCGP[2521:f803] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'invalid nib registered for identifier ((null)) - nib must contain exactly one top level object which must be a UITableViewCell instance'

I am trying to set up the following arrangement, so that each row segue's to a unique view. The following arrangement was easily done using a UITableViewController

2ezl4k7.png


However, this is proving impossible. in storyboard I cannot set up more than one segue from the table view when selecting each of the prototype table view cells individually.

How can I make a table view behave normally when embedded in a UIViewController - (Not UITableViewController?)
 
How are you loading the table view cells for your table view? It might be helpful to post your tableView:cellForRowAtIndexPath: code.

If you're using dynamic cells you may be forgetting to set the cell identifier in your storyboard.
 
Having the same issue

I'm having the same problem. Looks like its a common problem for people starting out with storyboard. Please post any suggestions that have worked.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.