i use the flooding code for preloading my images:
NSMutableArray *test_loose_preload = [[NSMutableArray alloc] initWithCapacity:test_loose_array.count];
for (int aniCount = 0; aniCount < test_loose_array.count; aniCount++) {
UIImage *frameImage = [test_loose_array objectAtIndex:aniCount];
UIGraphicsBeginImageContext(frameImage.size);
CGRect rect = CGRectMake(0, 0, frameImage.size.width, frameImage.size.height);
[frameImage drawInRect:rect];
UIImage *renderedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[test_loose_preload addObject:renderedImage];
}
test_loose = test_loose_preload;
Is there any possibility to check within this block if an image is already preloaded and no need to preload this one then any more?
Thanks for ideas!
Perhaps I’m misunderstanding the question, but it looks to me like an image is “pre-loaded” if you have built it and stuffed it into your test_loose_preload array. I gather that you’re concerned that some other thread may do the same work before you get through the array.
If so, then you can check for this by just checking [test_loose_preload objectAtIndex:aniCount], and if that result is non-nil, then skip that one and go on to the next index.