在我的应用程序中,我使用了performSelectorInBackground:
从磁盘加载图像。在使用 dispatch_async 进行一些单元测试后,我决定用 dispatch_async 调用替换我的 performSelectorInBackground。
dispatch_queue_t currentBackgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
dispatch_async(currentBackgroundQueue, ^{
[self getImageFromDisk:sPath delegate:(id)delegate];
});
该代码似乎有效,但现在我的图像加载速度比以前慢。当用户滚动图像时,这会导致黑色图像。
我的应用程序包含某种照片卷轴。我不能使用苹果的平铺示例代码,因为它会增加应用程序的大小。我使用这个片段从磁盘加载图像。