Skip to content

Instantly share code, notes, and snippets.

@atnan
Created May 29, 2011 13:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atnan/997780 to your computer and use it in GitHub Desktop.
Save atnan/997780 to your computer and use it in GitHub Desktop.
Fading view transition...
[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];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment