Using AFNetworking 2.0's method setImageWithUrl, I set an image in an imageView located in a UITableViewCell. It works fine when the image displayed is first downloaded and then set. If, however, the image is available locally (has been cached) when it's set, there's a quick white flash before it is displayed.
Do you know how to avoid this?
Steps to reproduce:
- Set image (image will be cached)
- Close application
- Start application
- Set (the now cached) image
Code for setting the image:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
myCell *cell = (myCell *)[tableView dequeueReusableCellWithIdentifier:@"imageCell"];
[cell.myImageView setImageWithURLRequest:[NSURLRequest requestWithURL:myImageUrl] placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
cell.myImageView.image = image;
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
NSLog(@"Failed");
}];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}