Skip to content

Instantly share code, notes, and snippets.

@thornpig
Last active April 25, 2016 23:36
Show Gist options
  • Save thornpig/ce01d04cc06e0ddb0ad3e1a4c4e864e1 to your computer and use it in GitHub Desktop.
Save thornpig/ce01d04cc06e0ddb0ad3e1a4c4e864e1 to your computer and use it in GitHub Desktop.
Notes on view controller transition and presentation
Suppose we have a presenting vc, vca, and a presented vc, vcb
If vca presentes vcb with UIModalPresentationFullScreen style,
vca's view will be moved to
transitionContext's containerView. During the transition animation
vcb's view is added on top of vca's view to the containerView. After the trainsition completes vca's view
is removed from the containerView, and vca has disappeared. During the dismissing trainsion, vca's view has to be
inserted to the containerView beneath vcb's view, so that vca's view will be revealed
as vcb's view moves off screen. If vca's view is not inserted back to containerView, a
black screen will be displayed at the end of the transition before vca's view appears.
On the other hand, if a custom presentation controller is used instead of UIFullscreenPresentationController,
vca's view will not be moved to the transitionContext's containterView before vcb's view is presented, and vca
will never disappear during the presenting/dismissing transition.
So when vcb's view is dismissed,
vca's view will be revealed immediately without a temperary black screen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment