UIImage,检查是否包含图像 [英] UIImage, check if contain image
本文介绍了UIImage,检查是否包含图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我实例化这样的UIImage:
If I instantiate a UIImage like this :
UIImage *image = [[UIImage alloc] init];
对象已创建,但不包含任何图像。
The object is created but it doesn't contain any image.
如何检查我的对象是否包含图像?
How I can check if my object contains an image or not?
推荐答案
你可以检查一下有任何图像数据。
You can check if it has any image data.
UIImage* image = [[UIImage alloc] init];
CGImageRef cgref = [image CGImage];
CIImage *cim = [image CIImage];
if (cim == nil && cgref == NULL)
{
NSLog(@"no underlying data");
}
[image release];
这篇关于UIImage,检查是否包含图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文