If I instantiate a UIImage like this :
UIImage *image = [[UIImage alloc] init];
The object is created but it doesn\'t contain any image.
This is updated version of @Kreiri, I put in a method and fixed logic error:
- (BOOL)containsImage:(UIImage*)image {
BOOL result = NO;
CGImageRef cgref = [image CGImage];
CIImage *cim = [image CIImage];
if (cim != nil || cgref != NULL) { // contains image
result = YES;
}
return result;
}
An UIImage could only based on CGImageRef or CIImage. If both is nil means there is no image. Example use of giving method:
if (![self containsImage:imageview.image]) {
[self setImageWithYourMethod];
}
hope it will help someone.