Skip to content

Instantly share code, notes, and snippets.

@diederikh
Last active April 17, 2017 00:45
Show Gist options
  • Save diederikh/7c9862750040951497ce to your computer and use it in GitHub Desktop.
Save diederikh/7c9862750040951497ce to your computer and use it in GitHub Desktop.
Transition to view controller within container view (called in performForSegue:)
- (void)switchToViewController:(UIViewController *)viewController
{
UIViewController *currentViewController = self.childViewControllers[0];
[self addChildViewController:viewController];
[self transitionFromViewController:currentViewController toViewController:viewController duration:0.2 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{}
completion:^(BOOL finished) {
[currentViewController removeFromParentViewController];
[self.containerView addSubview:viewController.view];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment