Skip to content

Instantly share code, notes, and snippets.

@kot-behemoth
Created October 13, 2012 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kot-behemoth/3885630 to your computer and use it in GitHub Desktop.
Save kot-behemoth/3885630 to your computer and use it in GitHub Desktop.
Modal push for UIViewController
#import <UIKit/UIKit.h>
@interface UIViewController (ModalPush)
- (void)pushViewControllerFromModal:(UIViewController *)VC animated:(BOOL)animated;
@end
#import "UIViewController+ModalPush.h"
@implementation UIViewController (ModalPush)
- (void)pushViewControllerFromModal:(UIViewController *)VC animated:(BOOL)animated
{
// Some neccessary iOS magic from http://www.kickasslabs.com/2009/07/03/uinavigationcontroller-tricks/
UIViewController * parentNavVC = (UIViewController *)self.navigationController.delegate;
[parentNavVC.navigationController pushViewController:VC animated:animated];
// After we pushed, we can dismiss the modal view
[self.parentViewController dismissModalViewControllerAnimated:animated];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment