Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fade in async loaded images in iOS

I'm trying to find a way to asynchronously load an image and then instead of having the images "just appear" in a UIImageView, have them fade in, similar to how it's done on the YouTube app on the iPad.

Does anyone have a clue on how I would do this? I've tried searching around for someone who has done something similar, but haven't had much luck yet and am not really sure where to get started.

like image 823
Dandy Avatar asked Dec 03 '10 19:12

Dandy


1 Answers

I had to roll my own solution as well. I started with this tutorial for async loading of UIImageViews (although it's talking about images in table views, the same principles apply to image views in general.

As far as the fade in part, that code block would look something like:

imageView.alpha = 0;
[UIView beginAnimations:@"fadeIn" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.3];

imageView.alpha = 1;
[UIView commitAnimations];
like image 151
James J Avatar answered Sep 30 '22 11:09

James J