Animation on the iPhone - use image sequence or rotation?

Posted by user157733 on Stack Overflow See other posts from Stack Overflow or by user157733
Published on 2010-05-04T08:32:08Z Indexed on 2010/05/04 8:38 UTC
Read the original article Hit count: 489

I am creating a basic animation for my iPhone app. I have a choice to make between 2 different types of animation. I can use this...

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];

or something like this...

    [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];

I have quite a few of these parts to animate so I want to choose an option which uses the least amount of memory and runds the quickest. Any advice would be great, thanks

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk