I’m loading 5 images from disk but I want the 1st image I read to show as soon as possible. Right now I do
UIImage *img = [UIImage imageWithContentsOfFile:path];
in a for loop but since imageWithContentsOfFile:path isn’t blocking all 5 images wind up getting read from disk before the first one will appear (because they’re all using up I/O). I confirmed this by just load one and it appeared on screen faster than if I load all 5.
I’d like to load the 1st image and block until its fully read and shown before loading the next 4 or load the 1st one and be notified when its done before loading the next 4 but I can’t figure out a way to do it. None of the ‘WithContentsOfFile’ methods for data or image block and they don’t notify or have delegate methods. Any suggestions?
Thanks
You can ensure that the image is fully loaded from disk by first loading the image file into a NSData object and then initialize the image with the data:
Claus