Skip to content

Instantly share code, notes, and snippets.

@arielelkin
Created July 30, 2012 11:35
Show Gist options
  • Save arielelkin/3206340 to your computer and use it in GitHub Desktop.
Save arielelkin/3206340 to your computer and use it in GitHub Desktop.
Custom Segue to slide a view controller from the top
-(void)perform{
UIViewController *splashScreen = self.sourceViewController;
UIViewController *mainScreen = self.destinationViewController;
[splashScreen.view addSubview:mainScreen.view];
mainScreen.view.center = CGPointMake(mainScreen.view.center.x, mainScreen.view.center.y-600);
[UIView animateWithDuration:1
animations:^{
mainScreen.view.center = CGPointMake(mainScreen.view.center.x, [[UIScreen mainScreen] bounds].size.height/2);
}
completion:^(BOOL finished){
[splashScreen presentModalViewController:mainScreen animated:NO];
[[splashScreen.view.subviews lastObject] removeFromSuperview];
}
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment