Skip to content

Instantly share code, notes, and snippets.

@spotlessicode
Created November 12, 2014 14:10
Show Gist options
  • Select an option

  • Save spotlessicode/1a432d1822ca400cdeed to your computer and use it in GitHub Desktop.

Select an option

Save spotlessicode/1a432d1822ca400cdeed to your computer and use it in GitHub Desktop.
- (void)perform
{
UIView *sourceView = ((UIViewController *)self.sourceViewController).view;
UIView *destinationView = ((UIViewController *)self.destinationViewController).view;
UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
destinationView.center = CGPointMake(sourceView.center.x, sourceView.center.y - destinationView.center.y);
[window insertSubview:destinationView aboveSubview:sourceView];
[UIView animateWithDuration:0.4
animations:^{
destinationView.center = CGPointMake(sourceView.center.x, sourceView.center.y);
sourceView.center = CGPointMake(sourceView.center.x, 0 + 2*destinationView.center.y);
}
completion:^(BOOL finished){
[[self sourceViewController] presentViewController:[self destinationViewController] animated:NO completion:nil];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment