2011-04-11 74 views

回答

0

這裏的人物是一個基本的方法,你可以嘗試:

UIImageView* backdropScene = [[UIImageView alloc] initWithFrame:self.view.frame]; 

backdropScene.animationImages = [NSArray arrayWithObjects:  
[UIImage imageNamed:@"rainy_background01.png"], 
[UIImage imageNamed:@"rainy_background02.png"], 
[UIImage imageNamed:@"rainy_background03.png"], 
[UIImage imageNamed:@"rainy_background04.png"], nil]; 

backdropScene.animationDuration = .2f; // image change rate, .2 seconds 
backdropScene.animationRepeatCount = 0; // repeat infinitely 
[self.view addSubview:backdropScene]; 
[backdropScene startAnimation]; 


UIImageView* foregroundAnimation = [[UIImageView alloc] initWithFrame:self.view.frame]; 

foregroundAnimation.animationImages = [NSArray arrayWithObjects:  
[UIImage imageNamed:@"man_walk01.png"], 
[UIImage imageNamed:@"man_walk02.png"], 
[UIImage imageNamed:@"man_walk03.png"], 
[UIImage imageNamed:@"man_walk04.png"], nil]; 

foregroundAnimation.animationDuration = .5f; // image change rate, .2 seconds 
foregroundAnimation.animationRepeatCount = 0; // repeat infinitely 
[self.view addSubview:foregroundAnimation]; 
[foregroundAnimation startAnimation];