I have a ViewController with 16 buttons. Each button loads a popover that show 50 frames renders in moving.
What is the best form to do it?
I know that imageWithName
is bad because it load all images in cache, and for this reason im doing it with:
myAnimatedView.animationImages=[NSArray arrayWithObjects:
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@0000",nombrePieza]ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@0001",nombrePieza]ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@0002",nombrePieza]ofType:@"png"]],
...
...
... [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@0050",nombrePieza]ofType:@"png"]],nil];
But when i load about 10 times the popover with differents frames, i have a leak of memory only on my device, but not in the simulator.
For this reason, i want know which is the best form to do it?
With a video? or with CAAnimation
?
Thanks for help.
You better use a timer in this case, not to have memory problems
This is an example to get ideas