开发者

can I check if downloaded image is corrupt or not before saving?

can I check if downloaded image is corrupt or not before saving it into my document director开发者_如何学运维y? if yes then please tell me how? thank you


UIImage *im = [[UIImage alloc] initWithData:YourNSData];
UIImageView *imview;

// test to see if the image was successfully created
if (im){
   imview = [[UIImageView alloc] initWithImage:im];
}

Hope this helps


You could try to load the NSData object in a UIIImage with the initData. Then check if the return UIImage object is nil. This is not full proof methods, but should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜