Skip to content

Instantly share code, notes, and snippets.

@lostincode
Last active December 16, 2015 16:49
Show Gist options
  • Save lostincode/5465456 to your computer and use it in GitHub Desktop.
Save lostincode/5465456 to your computer and use it in GitHub Desktop.
AFNetworking fade in on first load only.
__weak UITableViewCell *weakCell = cell;
[cell.imageView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]
placeholderImage:nil
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
if (response.statusCode == 0) return;
weakCell.imageView.alpha = 0;
weakCell.imageView.image = image;
[UIView animateWithDuration:0.5
delay:0
options:UIViewAnimationCurveEaseIn
animations:^{
weakCell.imageView.alpha = 1;
}
completion:nil];
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment