I have a Master-Detail application for iPad. I am using storyboard. When the user selects a cell in MasterViewcontroller, data is displayed in another table (UITableViewController). When the user selects a cell in the second table, I want to display the related information in the DetailViewController. The second table displays a list of documents (PDF, XLS, etc). So, when the user selects abc.pdf, I want the PDF document to be displayed (in read-only mode) in the Detailviewcontroller.
I have found several samples which do this directly from the MasterViewcontroller to the detailviewcontroller. But I am not able to achieve this from the second table. The navigation looks like this:
Table1 (parent data)
|
V
Table2 (child data, which as I said is a list of documents)
|
V
Detailview (display the selected document in read-only mode)
Storyboard or NIBs?
Assuming storyboard,
tableView:didSelectRowAtIndexPathmethod, perform the segue using that identifier;viewDidLoadof that controller, have it open up the PDF for viewing; andprepareForSegueof the master view controller, set the property of the new view controller based upon what row of your table was selected.If not storyboard, the process is similar, but rather than a segue and a
prepareForSegue, you’d manuallyalloc/initWithNibNameindidSelectRowAtIndexPath, you’d set the value of the pdf name property in your new controller, and then you’d transition the details screen to it via pushViewController or presentViewController, as you see fit.