Search code examples
objective-cuitableviewxcode4

How to implement UITableView-->Detail with Xcode4 Storyboards


as specified in the subject, I am trying to implement a really simple drill down interface using Xcode4 storyboards. Which is having a populated UITableView and see detail after clicking a cell.

I have a UITableView I am stuck at the point where I have to link the detail from the cell. Unfortunately all the tutorials shown on the web seem to stop at just displaying the populated table view, while nothing is spent about clicking on a cell and show details (if you know about a good one).

While I normally would use the didSelectRowAtIndexPath method for pushing controller to the navigation stack, I am a bit lost on how to connect the cell to the detail. What I have done so far is to ctrl+drag a connection from the cell to a new UIViewController dropped on the Storyboards, all I got is a black pop-up asking me three option modal, push, custom, I chooses push, but then how can I pass parameters ? How can I tell the detail view controller to show what I need ?

thanks


Solution

  • You send any required detail to the new controller in the prepareForSegue: method of the master view controller. Your destination view controller is available as a property of the segue, and you can use the selected row of the table view to derive which detail to pass.

    There is an excellent tutorial on the Ray Wenderlich site here, the segues are covered in part two but part one is a very good intro to the prototype cells and so forth.