I am loading 5 images from disk, but I want the first image that I read to be shown as soon as possible. I'm doing right now
UIImage *img = [UIImage imageWithContentsOfFile:path];
in a for loop, but since the imageWithContentsOfFile: path does not block all 5 images, they start reading from disk before the first one appears (because they all use I / O). I confirmed this by simply downloading one, and it appeared on the screen faster than if I downloaded all 5.
I want to download the 1st image and block it until it reads and reads completely before downloading the next 4, or download the 1st number and get a notification when it is done before the next 4 is downloaded, but I cannot figure out a way to do this. None of the "WithContentsOfFile" methods for a data block or image notifies or does not have delegation methods. Any suggestions?
thank
source
share