在我的应用程序中,我使用performSelectorInBackground:
从磁盘加载图像。在使用dispatch_async进行一些单元测试后,我决定用dispatch_async调用替换我的performSelectorInBackground。dispatch_async slow then performSelectorInBackground:?
dispatch_queue_t currentBackgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
dispatch_async(currentBackgroundQueue, ^{
[self getImageFromDisk:sPath delegate:(id)delegate];
});
该代码似乎工作,但现在我的图像加载速度较慢,然后之前。当用户滚动图像时,这会导致黑色图像。
我的应用程序包含一些类型的photoscroller。我无法使用苹果的平铺示例代码,因为它将应用程序大小增加了很多。我使用this片段从磁盘加载图像。
太好了,谢谢。我创建了一个自定义队列,它工作正常! – Tieme
真棒很高兴它的工作 –