• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[iPhone 3.0] -- UIImage imageFromContentsOfFile and animations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iPhone 3.0] -- UIImage imageFromContentsOfFile and animations


  • Subject: [iPhone 3.0] -- UIImage imageFromContentsOfFile and animations
  • From: John Michael Zorko <email@hidden>
  • Date: Wed, 12 Aug 2009 23:03:02 -0700


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_i", 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@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [iPhone 3.0] -- UIImage imageFromContentsOfFile and animations
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: Rotation and translation of an image
  • Next by Date: Does NSPrintOperation retain the NSWindow passed in runOperationModalForWindow
  • Previous by thread: Intermittent Console Log Entries '.sdef error' - Where from? What does it mean?
  • Next by thread: Re: [iPhone 3.0] -- UIImage imageFromContentsOfFile and animations
  • Index(es):
    • Date
    • Thread