Skip to content

Instantly share code, notes, and snippets.

@patsch
Created July 15, 2013 03:56
Show Gist options
  • Save patsch/5997409 to your computer and use it in GitHub Desktop.
Save patsch/5997409 to your computer and use it in GitHub Desktop.
iOS table view cell animation
// with animation:
NSURLRequest *ur = [NSURLRequest requestWithURL:imageURL];
// to fade the image in automatically when it's loaded:
// http://stackoverflow.com/questions/13974226/afnetworking-fade-animation-on-image-while-scrolling-uitableview
[cell.imageView setImageWithURLRequest:ur placeholderImage:[UIImage imageNamed:@"placeholder.png"] success:^(NSURLRequest *request , NSHTTPURLResponse *response , UIImage *image ){
if (request) {
//Fade animation
[UIView transitionWithView:cell.imageView
duration:1.0f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{[cell.imageView setImage:image];}
completion:NULL];
}
}
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