【发布时间】:2016-02-12 09:30:03
【问题描述】:
我正在使用 AFNetworking 为单元格占位符加载我的图像。这是我的代码示例。 (来自here的令牌)
NSURL *url = [NSURL URLWithString:daysWeather.weatherIconURL];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
UIImage *placeholderImage = [UIImage imageNamed:@"placeholder"];
__weak UITableViewCell *weakCell = cell;
[cell.imageView setImageWithURLRequest:request
placeholderImage:placeholderImage
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
NSLog(@"Load placeholder img");
weakCell.imageView.image = image;
[weakCell setNeedsLayout];
} failure:nil];
return cell;
现在我有一个问题。这些图像是否每次都加载,当它变得可见时?如您所见,我在成功块中添加了NSLog(@"Load placeholder img");。而且我看到,这段代码每次都会调用,当单元格变得可见时(在它可见之后,消失并再次变得可见)
【问题讨论】:
标签: ios uitableview afnetworking