I am using about 20 UIImageViews of small airplane images (50×50 pixels) doing simple animation on the iPhone screen. The animation is done by shifting the UIImageView center property at timer interval.
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]
What is the best practice: create one NSTimer and loop the 20 UIImageViews to set the center property when timer fired? Or should I just create one NSTimer per UIImageView object? Is NSTimer resource expensive?
I don’t think it’s that resource intensive, but common sense would seem to dictate that using 1 timer is probably better than 20.
Looks like your timer is set to fire 100 times per second, which seems a bit excessive. Do you animate each sprite at every timer firing? Might want to try firing 20-30 times per second instead (or maybe even less).
You might want to look into the built in view animation functions as well. Seems like they would probably work very well for what you are doing.