Skip to content

Instantly share code, notes, and snippets.

@Zhukn1
Created January 26, 2015 05:26
Show Gist options
  • Save Zhukn1/75064415269a784571d3 to your computer and use it in GitHub Desktop.
Save Zhukn1/75064415269a784571d3 to your computer and use it in GitHub Desktop.
Last completion block not called.
- (void)perform {
UIViewController *sourceController = self.sourceViewController;
UIViewController *destinationController = self.destinationViewController;
UIView *destView = destinationController.view;
destView.alpha = 0;
[sourceController.view addSubview:destView];
destView.frame = CGRectMake(0, 0,
CGRectGetWidth(sourceController.view.bounds),
CGRectGetHeight(sourceController.view.bounds));
destView.transform = CGAffineTransformMakeScale(0.05, 0.05);
CGPoint originalCenter = destinationController.view.center;
destinationController.view.center = self.originatingPoint;
[UIView animateWithDuration:0.4
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
destView.alpha = 1;
destView.transform = CGAffineTransformMakeScale(1, 1);
destinationController.view.center = originalCenter;
}
completion:^(BOOL finished){
[sourceController presentViewController:destinationViewController
animated:NO
completion:^{
[destView removeFromSuperview];
}];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment