-
-
Save McZonk/5633310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation IrisSegue | |
- (void)perform | |
{ | |
CATransition *shutterAnimation = [CATransition animation]; | |
[shutterAnimation setDelegate:self]; | |
[shutterAnimation setDuration:0.5]; | |
shutterAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
[shutterAnimation setType:@"cameraIris"]; | |
[shutterAnimation setStartProgress:0.5]; | |
CALayer *cameraShutter = [[CALayer alloc]init]; | |
[cameraShutter setBounds:CGRectMake(0.0, 0.0, 320.0, 425.0)]; | |
UIViewController* destination = self.destinationViewController; | |
[self.sourceViewController presentViewController:self.destinationViewController animated:NO completion:^{ | |
// don't ask - it just works with two calls to dispatch_async | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[destination.view.layer addSublayer:cameraShutter]; | |
[destination.view.layer addAnimation:shutterAnimation forKey:@"cameraIris"]; | |
}); | |
}); | |
}]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment