如何使用链接中的图像创建 UIImageView? [英] 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文