views:

40

answers:

1

Hi Everybody,

I m new to iphone app development and i need some help. I have a list of 30 images that i have to animate and display with 0.1 second interval. I put all the images in an Array using this

imageletter.animationImages = [NSArray arrayWithObjects:[UIImage imageNamed:@"1.png"], ...... ,nil]

And then animate it using these statements,

[imageletter setAnimationDuration:16];
[imageletter startAnimating];
[NSTimer scheduledTimerWithTimeInterval:mytime target:self selector:@selector(StopAfterCertainTime) userInfo:nil repeats:NO];

Now the problem is that the size of each image is 8kb , it runs fine on iphone simulator but crashes on device. When i used 30 other images of 4kb each it runs fine both on simulator and device. Can anybody tell me what is the ideal size for such kind of task. Thanks

A: 

I would suggest you first figure out why it's crashing on the device (look at a stack traceback, for example). 30 images of 8kb each doesn't sound like a lot of space (240kb, right?), so it's not likely a straightforward "out of memory" situation.

It's more likely that there's a deeper problem (for example, continuing to use an object after it's been released) that's sensitive to the size of objects you allocate. If that's so, using smaller images doesn't fix the problem, it merely hides it (for now).

Check out the Debugging Applications section of the iPhone Development Guide for information on viewing crash logs, and also on how to set NSZombieEnabled to detect accesses to released objects.

David Gelhar
The size of the compressed images may be 8 kb, but the uncompressed versions of these images used for actual display may be much larger than this. You should be able to see if this is causing a significant memory spike by looking at the Memory Monitor instrument.
Brad Larson