我正在尝试在 tableViewCell上ImageView
使用 AFNetworking设置图像。setImageWithURLRequest
如果我没有像这样在方法中包含success
andfailure
块:
[cell.thumbnailImageView setImageWithURL:url placeholderImage:nil];
一切正常,图像设置。不幸的是我需要积木。
这是我目前拥有的cellForRowAtIndexPath
:
if (self.images) { //check if the array of images is set, fetched from a URL
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString: [[self.images objectAtIndex:indexPath.row] objectForKey:@"tbUrl"]]];
[cell.thumbnailImageView setImageWithURLRequest:request placeholderImage:[UIImage imageNamed:@"placeholder"] success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
NSLog(@"success"); //it always lands here! But nothing happens
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
NSLog(@"fail");
}];
}