Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

xArtx

macrumors 6502a
Original poster
Hi Guys,

Just starting out here...

Code:
            UIImage *myImage = [UIImage imageNamed:@"imageArt.PNG"];
            CGPoint imagePoint = CGPointMake(156, 53);
            [myImage drawAtPoint:imagePoint];

Does this code read the image from the device's flash every time it occurs?
If so, how can I separate it so the image is loaded just once and can be
printed to the screen multiple times?

Cheers, Art.
 
I happen to know this one off the top of my head because I wondered the same thing roughly a year ago, but I'll point out how I learned the answer:

I checked Apple's docs.

From Apple's UIImage Class Reference, in the section for the imageNamed: method
Discussion
This method looks in the system caches for an image object with the specified name and returns that object if it exists. If a matching image object is not already in the cache, this method loads the image data from the specified file, caches it, and then returns the resulting object.
 
I happen to know this one off the top of my head because I wondered the same thing roughly a year ago, but I'll point out how I learned the answer:

I checked Apple's docs.

From Apple's UIImage Class Reference, in the section for the imageNamed: method

So it looks like I can reuse exactly the same three lines even if I print the picture to the screen a hundred times...
Thanks 🙂
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.