我正在爲我的iPhone應用程序創建基本動畫。我有兩種不同類型的動畫可供選擇。我可以用這...iPhone上的動畫 - 使用圖像序列或旋轉?
NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"myImage1.png"], [UIImage imageNamed:@"myImage2.png"], [UIImage imageNamed:@"myImage3.png"], [UIImage imageNamed:@"myImage4.gif"], nil]; UIImageView *myAnimatedView = [UIImageView alloc]; [myAnimatedView initWithFrame:[self bounds]]; myAnimatedView.animationImages = myImages; myAnimatedView.animationDuration = 0.25; [self addSubview:myAnimatedView]; [myAnimatedView release];
或這樣的事情...
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.5];
// other animations goes here
myImage.transform = CGAffineTransformMakeRotation(M_PI*0.5);
// other animations goes here
[UIView commitAnimations];
我有好幾個,這些部件的動畫,所以我要選擇一個選項,使用最少量的內存並且最快速地運行。任何建議將是偉大的,謝謝
感謝您的領導,這真的很有用。你會認爲使用一個小的PNG和平鋪它會更好地使用一個更大的單個PNG? – user157733 2010-05-04 15:41:45