1
我是iPad新手。我使用AQGridView来构建我的第一个ipad应用程序。使用下面的代码,我试图从网址中加载图片到网格的每个单元格中,但是当我向下滚动并返回时,图片与他们应该的不同,因此它们会重新加载以显示好的图片。AQGridview - 从网络载入图像(URL)
下面是我用来加载我的图像的代码。
dispatch_async(dispatch_get_global_queue(0, 0), ^{
UIImage *img = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imgPath]]];
dispatch_async(dispatch_get_main_queue(), ^{
_imageView.image = img;
[self setNeedsLayout];
});
});
我觉得问题来自这里,当调用dispatch_get_main_queue()。但我不知道如何解决这个问题。如果有人有一个想法,它肯定会帮助我!
非常感谢提前!
问候,
非常感谢你演示! –
嗯,那么你应该检查接受? – mackworth