It seems that even if the image is being downloaded in the background thread, the image data is being processed in the main thread, so it blocks your application. You can try the asynchronous image downloader provided by SDWebImage.
[SDWebImageDownloader.sharedDownloader downloadImageWithURL:imageURL options:0 progress:^(NSUInteger receivedSize, long long expectedSize) {
In your method, it should look like this:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"ArticleCell"; ArticleCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; Article *article = [parser items][indexPath.row]; cell.title.text = article.title; cell.tag = indexPath.row; cell.newsDescription.text = article.description; [SDWebImageDownloader.sharedDownloader downloadImageWithURL:imageURL options:0 progress:nil completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) { if (cell.tag == indexPath.row && image && finished) { dispatch_async(dispatch_get_main_queue(), ^(){ cell.image = image; }); } }]; return cell; }
The dude
source share