Created
November 12, 2014 14:45
-
-
Save spotlessicode/9de9e383fd66db6fee63 to your computer and use it in GitHub Desktop.
This file contains 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
#import "MyCustomUnwindSegue.h" | |
@implementation MyCustomUnwindSegue | |
- (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 belowSubview: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 destinationViewController] dismissViewControllerAnimated:NO completion:nil]; | |
}]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment