开发者

Concurrency in setting images iOS

I have an iOS app with an afopenflowview in one of the tabs. My code has

       loadImagesOperationQueue = [[NSOperationQueue alloc] init];

but it never really gets used, so I'm thinking that no concu开发者_JAVA百科rrency is actually taking place when setting the images.

I would like to basically split up the work of setting the images (I have 65 in total). So 32 images being set in one thread, with 33 in another (if that is logical).

Right now I'm setting images on the openflowview in my openflowviewcontroller like this

 [self.openFlowView setImage:[UIImage imageNamed:p.largeJPG] forIndex:index];

and the index increases through a for loop. But I'd like to speed up this operation because it is slowing down my app (when the openflowview tab is clicked). I feel like concurrency is the way to do it, I'm just not sure the best way to implement it.

Any help would be much appreciated!


I think your bottleneck here is disk access, not code execution speed. So concurrency won't help. But do you really need to load all 65 images at start? Try loading just a subset, then see if you can catch scroll messages and only load new images if it's really necessary.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜