0
如何在xcode上將兩組圖像製作爲一組?我的意思是一組背景或風景,而另一組則在後臺iphone中的動畫圖像層
如何在xcode上將兩組圖像製作爲一組?我的意思是一組背景或風景,而另一組則在後臺iphone中的動畫圖像層
這裏的人物是一個基本的方法,你可以嘗試:
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];