非常慢地滚动UITableView
张图片。请帮助我。
没有找到合适的解决方案
我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *const ImageCellId = @"ImageCell";
EXImageCell *cell = [tableView dequeueReusableCellWithIdentifier:ImageCellId];
RSSItem *item = [_data objectAtIndex:indexPath.row];
cell.cellTextLabel.text = item.title;
cell.cellTimeTextLabel.text = [NSDateFormatter localizedStringFromDate:item.pubDate dateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterShortStyle];
cell.cellAuthor.text = [NSString stringWithFormat:@"Author: %@", item.author];
NSURL *tutorialsUrl = item.link;
NSData *tutorialsHtmlData = [NSData dataWithContentsOfURL:tutorialsUrl];
TFHpple *tutorialsParser = [TFHpple hppleWithHTMLData:tutorialsHtmlData];
NSString *tutorialsXpathQueryString = @"//div[@class='photo']/img";
NSArray *tutorialsNodes = [tutorialsParser searchWithXPathQuery:tutorialsXpathQueryString];
//NSMutableArray *newTutorials = [[NSMutableArray alloc] initWithCapacity:0];
for (TFHppleElement *element in tutorialsNodes) {
tutorial = [[Tutorial alloc] init];
//[newTutorials addObject:tutorial];
//tutorial.title = [[element firstChild] content];
tutorial.url = [element objectForKey:@"src"];
}
NSData *data = [NSData dataWithContentsOfURL : [NSURL URLWithString:tutorial.url]];
UIImage *imageMain = [UIImage imageWithData:data];
[cell.cellImageView setImage:imageMain];
return cell;
}
PS:dispatch_async
试图使用,但无济于事