Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone How to get image back from NSData

In my iPhone App I am storing image into NSData by

UIImage *image =imageView.image;

NSData *myData = UIImagePNGRepresentation(image);

But How to get back "image" from "NSData" and I can display it again into in to UIImageView.

Please Help and Suggest, Thanks.

like image 530
ios Avatar asked Nov 30 '22 04:11

ios


2 Answers

have you tried +[UIImage imageWithData:]?

like image 95
justin Avatar answered Dec 09 '22 17:12

justin


UIImage *img=[UIImage imageWithData:data];
[yourImageView setImage:img];
like image 26
Jorge Avatar answered Dec 09 '22 17:12

Jorge