Skip to content

Instantly share code, notes, and snippets.

@jackhl
Created December 27, 2011 21:16
Show Gist options
  • Save jackhl/1525182 to your computer and use it in GitHub Desktop.
Save jackhl/1525182 to your computer and use it in GitHub Desktop.
- (void) flipToGameScreen:(NSInteger *)aMode aLevel:(NSInteger*)aLevel
{
//NSInteger *myMode = aMode; you don't need to do this... you can just directly use aLevel and aMode
//NSInteger *myLevel = aLevel;
GameScreenViewController *aGameScreenView = [[GameScreenViewController alloc] initWithNibName:@"GameScreen" mode:aMode level:aLevel bundle:nil];
[self setGameScreenViewController:aGameScreenView];
[aGameScreenView release];
gameScreenViewController.view.frame =[[UIScreen mainScreen] applicationFrame];
//animation
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache: YES];
[viewController.view removeFromSuperview];
[self.window addSubview:[gameScreenViewController view]];
[UIView commitAnimations];
}
// iFocus2AppDelegate needs a type, unless it's a synthesized property. If it is, you should never release it inside a method other than dealloc
- (void) alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
iFocus2AppDelegate *mainDelegate = (iFocus2AppDelegate *)[[UIApplication sharedApplication] delegate];
if (buttonIndex == 0)
{
//PlayAgain
[mainDelegate flipToGameScreen:selectedMode aLevel:selectedLevel];
}
if (buttonIndex == 1)
{
//scores
[mainDelegate flipToHiScores];
}
if (buttonIndex == 2)
{
//settings
[mainDelegate flipToGameSettings];
}
[iFocus2AppDelegate release];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment