1.访问网络资源URL
let urlStr =NSURL(string:"https://******jpg")
2.读取图片数据
let data =NSData(contentsOfURL: urlStr!)
let image =UIImage(data: data!)
3.显示图片
let imageView =UIImageView(image: image)
imageView.frame =CGRectMake(0,0,SCR_PAGE.width,SCR_PAGE.height)
self.view.addSubview(imageView)
网友评论