TableView in UIViewController issue

Discussion in 'iOS Programming' started by nashyo, Apr 25, 2012.

  1. nashyo macrumors 6502

    nashyo

    Joined:
    Oct 1, 2010
    Location:
    Bristol
    #1
    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

    [​IMG]

    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?)
     
  2. ppilone macrumors 6502

    Joined:
    Jan 20, 2008
    #2
    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.
     
  3. ppranav macrumors newbie

    Joined:
    Apr 26, 2012
    #3
    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.
     

Share This Page