相关疑难解决方法(0)

iOS SDWebImage淡入新图像

我一直在我的iPhone应用程序上使用SDWebImage来处理所有图像加载.我正在使用占位符图像,并且我想在加载后对新图像进行交叉淡入淡出或淡入淡出.我使用成功块来设置图像,它工作得很好.无论我尝试什么,图像都不会淡入.我已经尝试将动画代码发送回主线程,但这也无济于事.它只是立即加载......没有动画.

这是我的代码.有什么想法吗?

// load placeholder image
NSURL *url = ...
_imageView = [[UIImageView alloc] init];
[_imageView setImage:[UIImage imageNamed:@"loading.jpg"]];

// request image
SDWebImageManager *manager = [SDWebImageManager sharedManager];
[manager downloadWithURL:url
                delegate:self
                 options:0
                 success:^(UIImage *image) {

                     [UIView transitionWithView:_imageView
                                       duration:3.0
                                        options:UIViewAnimationOptionTransitionCrossDissolve
                                     animations:^{
                                         [_imageView setImage:image];
                                     } completion:NULL];

}
failure:nil];
Run Code Online (Sandbox Code Playgroud)

asynchronous image fade ios sdwebimage

11
推荐指数
4
解决办法
1万
查看次数

标签 统计

asynchronous ×1

fade ×1

image ×1

ios ×1

sdwebimage ×1