My app crashes due to memory building up after every animation.
Here is my sample code:
-(IBAction) shoot: (id)delegate{
[gun setImage:[UIImage imageNamed:@"animation_machin_guns_320x480_7.png"]];
UIImage *frame1 = [UIImage imageNamed:@"animation_machin_guns_320x480_1.png"];
UIImage *frame2 = [UIImage imageNamed:@"animation_machin_guns_320x480_2.png"];
UIImage *frame3 = [UIImage imageNamed:@"animation_machin_guns_320x480_3.png"];
UIImage *frame4 = [UIImage imageNamed:@"animation_machin_guns_320x480_4.png"];
UIImage *frame5 = [UIImage imageNamed:@"animation_machin_guns_320x480_5.png"];
UIImage *frame6 = [UIImage imageNamed:@"animation_machin_guns_320x480_6.png"];
UIImage *frame7 = [UIImage imageNamed:@"animation_machin_guns_320x480_7.png"];
gun.animationImages = [[NSArray alloc] initWithObjects:frame1, frame2, frame3, frame4, frame5, frame6, frame7,nil];
gun.animationDuration = 1;
gun.animationRepeatCount = 1;
[gun startAnimating];
[frame1 release];
[frame2 release];
[frame3 release];
[frame4 release];
[frame5 release];
[frame6 release];
[frame7 release];}
Releasing the frames doesn't seem to do the magic. I tried using this http://kosmaczewski.net/projects/iphone-image-cache/ for image caching but i guess I don't know how to use it properly since the memory builds up faster than using imageNamed.