Skip to content

Instantly share code, notes, and snippets.

@PaulSolt
Created January 4, 2014 16:00
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 PaulSolt/8256785 to your computer and use it in GitHub Desktop.
Save PaulSolt/8256785 to your computer and use it in GitHub Desktop.
Modal Context to Layer UIViewControllers with Transparency
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.gameState = GameStateMenu;
self.definesPresentationContext = NO;
self.modalPresentationStyle = UIModalPresentationFormSheet;
self.menuScreenViewController = [[MenuScreenViewController alloc] init];
self.menuScreenViewController.definesPresentationContext = YES;
self.menuScreenViewController.providesPresentationContextTransitionStyle = YES;
self.menuScreenViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
self.menuScreenViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
self.menuScreenViewController.mainViewController = self;
self.pauseScreenViewController = [[PauseScreenViewController alloc] init];
self.pauseScreenViewController.definesPresentationContext = YES;
self.pauseScreenViewController.providesPresentationContextTransitionStyle = YES;
self.pauseScreenViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
self.pauseScreenViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
self.pauseScreenViewController.mainViewController = self;
self.deathScreenViewController = [[DeathScreenViewController alloc] init];
self.deathScreenViewController.definesPresentationContext = YES;
self.deathScreenViewController.providesPresentationContextTransitionStyle = YES;
self.deathScreenViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
self.deathScreenViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
self.deathScreenViewController.mainViewController = self;
self.storeViewController = [[StoreViewController alloc] init];
self.storeViewController.definesPresentationContext = YES;
self.storeViewController.providesPresentationContextTransitionStyle = YES;
self.storeViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
self.storeViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
self.storeViewController.delegate = self;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment