To create a custom segment that the view slide controllers first create a class that extends the UIStoryboardSegue, then override the execution selector. I just did something like this and it will work for you too. Here is my code:
#define kAnimationDuration 0.5 #import "CustomSlideSegue.h" @implementation CustomSlideSegue - (void)perform { UIViewController *sourceViewController = (UIViewController *) self.sourceViewController; UIViewController *destinationViewController = (UIViewController *) self.destinationViewController; [sourceViewController.view addSubview:destinationViewController.view]; [destinationViewController.view setFrame:sourceViewController.view.window.frame]; [destinationViewController.view setBounds:sourceViewController.view.bounds]; CGSize screenSize = [[UIScreen mainScreen] bounds].size; if ( !self.slideLeft ) { [UIView animateWithDuration:kAnimationDuration delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{ [destinationViewController.view setCenter:CGPointMake(screenSize.height + screenSize.height/2, screenSize.height/2 - 138)]; [destinationViewController.view setCenter:CGPointMake(screenSize.width/2 + 127, screenSize.height/2 - 138)]; } completion:^(BOOL finished){ [destinationViewController.view removeFromSuperview]; [sourceViewController presentViewController:destinationViewController animated:NO completion:nil]; }]; } else { [UIView animateWithDuration:kAnimationDuration delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{ [destinationViewController.view setCenter:CGPointMake(-1*screenSize.height/2, screenSize.height/2 - 138)]; [destinationViewController.view setCenter:CGPointMake(screenSize.width/2 + 127, screenSize.height/2 - 138)]; } completion:^(BOOL finished){ [destinationViewController.view removeFromSuperview]; [sourceViewController presentViewController:destinationViewController animated:NO completion:nil]; }]; } }
Then, when you want to execute segue, use this code:
UIViewController *destination = [self.storyboard instantiateViewControllerWithIdentifier:@"some identifier"]; CustomZoomSegue *segue = [[CustomZoomSegue alloc] initWithIdentifier:@"segue vc identifier" source:self destination:destination]; [self prepareForSegue:segue sender:self]; [segue perform];
CGPointMake calls are common to my code (I used landscape orientation), but you should be able to change it to suit your needs. If you need to clarify or ask a question, let me know and I will try to answer.
NOTE. I use storyboards without segue lines between view controllers.
source share