Hello, all ...

The source of my problem seems to be using UIImage -imageNamed to load my array of PNGs to be animated, since imageNamed caches the data in case I ask for it again.

However, though replacing imageNamed with imageFromContentsOfFile works wherever I set a UIImageView's image property, doing so to load the PNG images into my animation array results in the animation being invisible on the device, though it works in the simulator. Here's my code:

        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

            for (frameIndex = 0; frameIndex <= 30; frameIndex ++)
            {
NSString *frameName = [NSString stringWithFormat:@"clapping_%05i", frameIndex]; NSString *path = [[NSBundle mainBundle] pathForResource:frameName ofType:@"png" inDirectory:@"clapping"]; UIImage *image = [UIImage imageWithContentsOfFile:path];

                if (image != nil)
                {
                    [self.animationArray addObject:image];
                }
            }

            [pool release];


I've tried various combinations of the inDirectory parameter, to no avail -- it plays on the sim, not on the device. However, using UIImage imageNamed works on the device, but uses up a lot of memory that causes my glitch. What to do? If anyone could tell me how to use imageFromContentsOfFile to load an array that UIImageView startAnimating will play, i'd love to hear about it :-)
Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.com



_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to