【发布时间】:2013-12-24 00:55:45
【问题描述】:
我有一个 UIImageView。此 imageView 的图像是从 Web 加载的。谁能告诉我如何停止加载?
这是我的代码:
UIImageView *currentImgView = (UIImageView *)[self.scrollView viewWithTag:self.pageControl.currentPage + 500];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
UIImage *newImg = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[[self.imagesStructure valueForKey:DATA_PARAMETER] objectAtIndex:self.pageControl.currentPage] valueForKey:@"source"]]]];
dispatch_async(dispatch_get_main_queue(), ^{
currentImgView.image = newImg;
[self hideActivityView];
});
});
【问题讨论】:
-
您的具体要求是什么??何时停止加载数据??
标签: ios objective-c dispatch-async