Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'd use a custom container view controller. So to your main scene, add a "container view". If your target is iOS6, then when editing your storyboard there is a special "container view" object that you can now drag onto your custom container view controller's scene:</p> <p><img src="https://i.stack.imgur.com/f8UJm.png" alt="container view"></p> <p>If iOS 5, then (a) you have to create the first child scene manually; (b) give it a unique storyboard id (in my example, <code>InitialChild</code>, and (c) you manually instantiate that first child controller and add it as a child programmatically. Thus, assuming you have a <code>UIView</code> called <code>containerView</code> in your custom container view controller's scene, you can have a method like:</p> <pre><code>- (void)addInitialChild { UIViewController *child = [self.storyboard instantiateViewControllerWithIdentifier:@"InitialChild"]; [self addChildViewController:child]; child.view.frame = self.containerView.bounds; [self.containerView addSubview:child.view]; [child didMoveToParentViewController:self]; } </code></pre> <p>When you want to transition to the next scene, subclass your own <code>UIStoryboardSegue</code>:</p> <p>In ReplaceSegue.h:</p> <pre><code>@interface ReplaceSegue : UIStoryboardSegue @end </code></pre> <p>In ReplaceSegue.m</p> <pre><code>@implementation ReplaceSegue - (void)perform { UIViewController *source = self.sourceViewController; UIViewController *destination = self.destinationViewController; UIViewController *container = source.parentViewController; [container addChildViewController:destination]; destination.view.frame = source.view.frame; [source willMoveToParentViewController:nil]; [container transitionFromViewController:source toViewController:destination duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ } completion:^(BOOL finished) { [source removeFromParentViewController]; [destination didMoveToParentViewController:container]; }]; } @end </code></pre> <p>Then, when doing a segue from the first contained scene to the next, specify a "custom" segue, and use this "ReplaceSegue" as the class (just click on the segue to select it and then look at the "Attributes inspector").</p> <p><img src="https://i.stack.imgur.com/hAifD.png" alt="enter image description here"></p> <p>The resulting storyboard might look like (note the "<code>{}</code>" designation between the various children):</p> <p><img src="https://i.stack.imgur.com/pO2WC.png" alt="containment storyboard"></p> <hr> <p>References:</p> <ul> <li><p>For general discussion of containment, see <a href="http://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006926-CH3-SW81">Implementing a View Container Controller</a> in the <em>UIViewController Class Reference</em>.</p></li> <li><p>For some details about the implementation, see <a href="http://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html#//apple_ref/doc/uid/TP40007457-CH18-SW6">Creating Custom Container View Controllers</a> in the <em>View Controller Programming Guide for iOS.</em></p></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload