技术UIImage

NSData和UIImage

2015-11-18  本文已影响129人  952625a28d0d

我们从网络上下载的NSData类型的图片数据,怎么展示为UIImage类型的?

UIImage has an -initWithData:
 method. From the docs: "The data in the data parameter must be formatted to match the file format of one of the system’s supported image types."```

- NSData转换为UIImage

NSData *imageData = UIImagePNGRepresentation(image);
UIImage *image=[UIImage imageWithData:data];```

UIImage *img = [UIImage imageNamed:@"image.png"];
NSData *data1 = UIImagePNGRepresentation(img);```

上一篇 下一篇

猜你喜欢

热点阅读