How to create UIImageView with image from a link?(如何使用链接中的图像创建 UIImageView?)
问题描述
如何使用来自这样的链接的图像创建 UIImageView http://img.abc.com/noPhoto4530.gif?
How to create UIImageView with image from a link like this http://img.abc.com/noPhoto4530.gif?
推荐答案
NSURL *url = [NSURL URLWithString:@"http://img.abc.com/noPhoto4530.gif"];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:data];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
这篇关于如何使用链接中的图像创建 UIImageView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!