NSData and UIImage

后端 未结 5 1955
孤独总比滥情好
孤独总比滥情好 2020-12-13 03:51

I am trying to load UIImage object from NSData, and the sample code was to NSImage, I guess they should be the same. But just now load

5条回答
  •  -上瘾入骨i
    2020-12-13 04:12

    Try this to convert an image to NSdata:

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

提交回复
热议问题