Skip to content

Instantly share code, notes, and snippets.

@zeedark
Created January 27, 2012 19:11
Show Gist options
  • Save zeedark/1690396 to your computer and use it in GitHub Desktop.
Save zeedark/1690396 to your computer and use it in GitHub Desktop.
Horizontal flip transition of a modal view with back button
//
// SomeViewController.m
//
- (IBAction)doShowSomething:(id)sender
{
UINavigationController *nav = [[[UINavigationController alloc]init] autorelease];
MyViewController *av = [[[MyViewController alloc] init] autorelease];
[nav pushViewController:av animated:NO];
[nav setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[nav setModalPresentationStyle:UIModalPresentationCurrentContext];
[self.navigationController presentModalViewController:nav animated:YES];
}
//
// MyViewController.m
//
- (void)viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem *bt = [[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(doBack:)] autorelease];
self.navigationItem.rightBarButtonItem = bt;
}
-(IBAction)doBack:(id)sender
{
[self dismissModalViewControllerAnimated:YES];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment