NSData与UIImage互相转换

 1.//NSData转换为UIImage
 NSData *imageData = [NSData dataWithContentsOfFile: imagePath];
 UIImage *image = [UIImage imageWithData: imageData];
 
 2.//UIImage转换为NSData
 NSData *imageData = UIImagePNGRepresentation(image);
posted @ 2016-10-21 13:40  柳仙慧子  阅读(6725)  评论(0编辑  收藏  举报