I find this to be the easiest method rather than writing mounds of code to just slide a frame.
Here's the custom segue
- (void) perform {
UIView *oldView = ((UIViewController *)self.sourceViewController).view;
UIView *newView = ((UIViewController *)self.destinationViewController).view;
[oldView.window insertSubview:newView aboveSubview:oldView];
float offsetY = newView.center.y - oldView.center.y ;
//NSLog(@"old y = %f, new y = %f , offsetY = %f", oldView.center.y, newView.center.y, offsetY);
// assuming newView and oldView both sized to fill screen,
// position newView just to the right of oldView
newView.center = CGPointMake(oldView.center.x + oldView.frame.size.width, oldView.center.y + offsetY);
//NSLog(@"newView center x = %f y = %f", newView.center.x, newView.center.y);
// slide newView over oldView, then remove oldView
[UIView animateWithDuration:0.3
animations:^{ newView.center = CGPointMake(oldView.center.x, oldView.center.y + offsetY);}
completion:^(BOOL finished){ [oldView removeFromSuperview]; }];
}
Hope this helps!