convert UIImage to NSData and back to UIImage

前端 未结 5 1493
难免孤独
难免孤独 2020-12-31 15:13

I have to populate table cell from database and images are on device. I\'ve to store that image in imageDataObject, how to convert that UIImage to

5条回答
  •  Happy的楠姐
    2020-12-31 15:36

    Try With this:

    Use this for convert UIImage to NSData.

      NSData *imagedata = UIImagePNGRepresentation(thumbnail);
    

    Try this for image data convert back to UIImage

      UIImage *image= [UIImage imageWithData:imagedata];
    

提交回复
热议问题