Should Xcode Storyboard support segues from a UITableView with 'dynamic prototype' cells?

11,041

Solution 1

No, you don't have to manually push the child controller. Did you connect a segue in your storyboard file from the dynamic cell to the child controller? Also did you give your dynamic cells an identifier? You can also check out this tutorial:

http://maniacdev.com/ios-5-sdk-tutorial-and-guide/xcode-4-storyboard/

Scroll down to "Beginning iOS storyboards" and have a look at part 1 and part 2. I found them most helpful.

Solution 2

Use prepareForSugue: instead, [table indexPathForSelectedRow prepareForSugue will be called before the next scene's loadView.

Share:
11,041
Greg
Author by

Greg

Updated on June 14, 2022

Comments

  • Greg
    Greg almost 2 years

    I can't get this working. If I drop the master UITableView to use Static cells I can get the segues working, such that when you click on a row in the master it automatically pushes the Child controller on. But with 'dynamic prototype' cells, I click on one of the cells and nothing happens...

    Am I supposed to programmatically push the child controller within the prepareForSegue method or something? In which case I'm not sure what advantage a segue here would have over the old way of just using

  • Greg
    Greg over 12 years
    oh - I had an identifer, but I didn't match it up between the Storyboard and the cellForRowAtIndexPath. Working now. So does this mean in the cellForRowAtIndexPath using Storyboard you only have to use a "UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];"? That is you don't need the "if (cell == nil) { then create one..." as well?
  • Jamie
    Jamie over 12 years
    As far as I understand, that is correct. The storyboard now takes care of creating them for you.
  • chown
    chown over 12 years
    Thank you for this answer. It helped me.
  • Janak Nirmal
    Janak Nirmal over 11 years
    This should be as comment not as an answer.