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 f开发者_开发技巧or someone who has done something similar, but haven't had much luck yet and am not really sure where to get started.
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];
精彩评论