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];
let image = UIImage() let cgref = image.cgImage let cim = image.ciImage if cim == nil && cgref == nil { print("no underlying data") }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With