0
我正在開發一個遊戲在Xcode 4.3.2UIImage視圖動畫有一次工作...爲什麼?
在遊戲中顯示我需要經常調用這個函數可以在屏幕上添加兩個圖像與動畫,第一影像輸入左,右二和後2秒關閉了:
-(void) PandaAnimation2 {
[pandablock3 removeFromSuperview];
[awesomeview removeFromSuperview];
//pandablock3 is a UIImageView
//awesomeview is a UIImageView
pandablock3.frame = CGRectMake(400, 101, 111, 208);
awesomeview.frame = CGRectMake(-400, 9, 230, 68);
[self addSubview:pandablock3];
[self addSubview:awesomeview];
[UIImageView beginAnimations:@"movein" context:NULL];
[UIImageView setAnimationBeginsFromCurrentState:YES];
[UIImageView setAnimationDelegate:self];
[UIImageView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIImageView setAnimationDuration:2.0];
pandablock3.frame = CGRectMake(208, 101, 111, 208);
awesomeview.frame = CGRectMake(11, 9, 230, 68);
[UIImageView commitAnimations];
[UIImageView beginAnimations:@"moveout" context:NULL];
[UIImageView setAnimationDelay:2.0];
[UIImageView setAnimationBeginsFromCurrentState:YES];
[UIImageView setAnimationDelegate:self];
[UIImageView setAnimationDuration:1.0];
[UIImageView setAnimationCurve:UIViewAnimationCurveEaseOut];
pandablock3.frame = CGRectMake(400, 101, 111, 208);
awesomeview.frame = CGRectMake(-400, 9, 230, 68);
[UIImageView commitAnimations];
}
它的作品不錯,但只有一次! 爲什麼?
請幫忙!
ops ...對!我需要將UIImageView定義爲函數!謝謝! – altod