Skip to content

Instantly share code, notes, and snippets.

@jeksys
Created December 21, 2011 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeksys/1507490 to your computer and use it in GitHub Desktop.
Save jeksys/1507490 to your computer and use it in GitHub Desktop.
Custom modal UIViewController transitions
Just a snippet.
Note: Don’t push or remove view controllers with non-opaque views. The underlying view of the parent view controller is removed.
[CATransaction begin];
CATransition *transition = [CATransition animation];
transition.type = kCATransitionFade;
transition.duration = animated ? 0.5f : 0.0f;
transition.fillMode = kCAFillModeForwards;
transition.removedOnCompletion = YES;
[[UIApplication sharedApplication].keyWindow.layer addAnimation:transition forKey:@"transition"];
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[CATransaction setCompletionBlock: ^ {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(transition.duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^ {
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
});
}];
[self presentModalViewController:someVC animated:NO];
[CATransaction commit];
http://monoceroi.tumblr.com/post/5924267283/custom-modal-uiviewcontroller-transitions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment