最近忙碌图片合成视频的需求,在该需求中,需要使用到网络图片
SDWebImage提供了简练的API获取网络图片,但是主要实现是直接把图片给UIImageView
但是,如果只想要下载和获取Image,没有现成的简单API可以使用;最近又阅读了SDWebImage的源码,换种方法可以实现。
1.在主线程
有一种很简单的办法获取到这个图片,这个方法不是很"美观",但是用起来很方便
__block UIImage *imageNew;
NSString *imageAddress = @"这个是图片的网络地址";
NSURL* downLoadUrl = [NSURL URLWithString:imageAddress];
UIImageView *imageView = [[UIImageView alloc] init];
[imageView sd_setImageWithURL:downLoadUrl completed:^(UIImage *image