UISplitViewController on iPad with Storyboards?

前端 未结 3 1585
既然无缘
既然无缘 2020-12-09 22:49

\"enter

In Xcode, how can I create a simple iPad application that uses Storyboards suc

相关标签:
3条回答
  • 2020-12-09 23:23

    A good starting point for segues are Lectures 6 and 7 of Stanford's CS193p Fall 2011 class.

    http://itunes.apple.com/us/itunes-u/ipad-iphone-application-development/id473757255

    The instructor, Paul Hegarty, covers everything. However, he runs out of time before the end of class to answer this question. He does include the source with the final solution in the file: Psychologist with Dr Pill.zip.

    http://www.stanford.edu/class/cs193p/cgi-bin/drupal/downloads-2011-fall

    Basically, all that needs to be done for this question is to Ctrl-drag from each UITableCell to the respective game detail view controllers then select the Replace segue. There is one more step because the view controller will shrink because by default Xcode thinks that you want to replace the master controller. For each of the segues, select the connection line and in the Attributes inspector then change the Destination from "Master Split" to "Detail Split". At this point, you can test with the popover, without writing any code.

    Master Split Destination

    Detail Split Destination

    Solution

    0 讨论(0)
  • 2020-12-09 23:25

    Apple has provided sample code of a more general solution to the problem of how to swap out different detail views based on what is selected in the master view. The Apple example code accomplishes this by introducing a custom implementation of the UISplitViewControllerDelegate protocol:

    https://developer.apple.com/library/ios/samplecode/MultipleDetailViews/Introduction/Intro.html

    0 讨论(0)
  • 2020-12-09 23:33

    Hard to describe without pictures but: have a navigation controller as the master. Then hang each detailview off this with a named segue that replaces. Then you need a bit of code. In you master viewcontroller inside didSelectRowAtIndexPath, you need a switch statement based on indexpath.row and in each row call detailview performSegueWithIdentifier:@"the row you want"

    0 讨论(0)
提交回复
热议问题