-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomSegue.m
32 lines (26 loc) · 1.05 KB
/
customSegue.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// customSegue.m
// Carl Energy
//
// Created by Larkin Flodin on 6/1/14.
// Copyright (c) 2014 Carleton College. All rights reserved.
//
#import "customSegue.h"
@implementation customSegue
- (void) perform
{
UIView *preV = ((UIViewController *)self.sourceViewController).view;
UIView *newV = ((UIViewController *)self.destinationViewController).view;
UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
newV.center = CGPointMake(preV.center.x - preV.frame.size.width, preV.center.y);
[window insertSubview:newV aboveSubview:preV];
[UIView animateWithDuration:0.3
animations:^{
newV.center = CGPointMake(preV.center.x, preV.center.y);
preV.center = CGPointMake(preV.center.x + preV.frame.size.width, preV.center.y);}
completion:^(BOOL finished){
[preV removeFromSuperview];
window.rootViewController = self.destinationViewController;
}];
}
@end