UISplitViewController on iPad with storyboard?

enter image description here

In Xcode, how can I create a simple iPad application that uses Storyboards so that the DetailView controller changes for each post? Most of the examples I've seen use an iPhone or just change values ​​in the same verbose view controller.

I want to create segues in Interface Builder from a static TableView controller (with three rows), where each row will load a different game view controller, which I would pull out and develop in IB. Currently, when I connect a view controller using segue, it replaces the navigation part of the UISplitViewController. In other words, it looks like I'm browsing a tree, and I need to tell IB that I am in the root of the node, and I need to change the Detail view.

+6
source share
3 answers

A good starting point for segues are Stanford CS193p class lectures 6 and 7 in the fall of 2011.

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 the class to answer this question. It includes the source with the final decision in the file: Psychologist with Dr Pill.zip.

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

Basically, all you need to do for this question is to drag Ctrl from each UITableCell to the respective controllers for viewing detailed games, and then select "Replace segue". There is one more step, because the view controller will shrink, because by default, Xcode considers that you want to replace the main controller. For each of the segments, select a connection line and an attribute inspector, then change the destination of the Split Wizard to Detailed Separation. At this point, you can test with popover without writing any code.

Master Split Destination

Detail Split Destination

Solution

+18
source

Apple has provided sample code for a more general solution to the problem of how to change different views of parts based on what is selected in the main view. Apple sample code accomplishes this by introducing a custom implementation of the UISplitViewControllerDelegate protocol:

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

+1
source

It's hard to describe without photos, but: have a navigation controller as a wizard. Then hang each detailview with that name with a replacement. Then you need some code. In your master viewcontroller inside didSelectRowAtIndexPath, you need a switch statement based on indexpath.row, and in each call to detailview viewSegueWithIdentifier: @ "desired line"

0
source

Source: https://habr.com/ru/post/908399/


All Articles