Game Development Reference
In-Depth Information
Figure 4-5. Fade transition animation
In this fade transition, the Welcome view is replaced with the High Score view. This is accomplished
by changing the opacity of each view over a period of time. During this animation, both views are
part of the scene. At the end, we want to remove the Welcome view, to stay consistent with how we
are managing views in the game. The code that creates this transition is shown in Listing 4-5.
Listing 4-5. GameController.m (highScoresClicked:)
- (IBAction)highScoresClicked:(id)sender {
//Make high score view 100% clear and add it on top of the welcome view.
[highscoreController.view setAlpha:0.0];
[self.view addSubview:highscoreController.view];
//set up animation
[UIView beginAnimations:nil context:@"fadeInHighScoreView"];
[UIView setAnimationDuration:1.0];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
 
Search WWH ::




Custom Search