Can image.CGImage
ever return null
if UIImage
was being created from file or from bundle?
UIImage image = UIImage.FromFile(name);
// or
UIImage image = UIImage.FromBundle(name);
// image.CGImage == null?
Thanx to @BytesGuy for help. As he said UIImage.FromFile
and UIImage.FromBundle
can't return UIImage
with null
CGImage
.
Some correction for his answer:
The
UIImage
can itself benull
(and thereforeUIImage.CGImage
will also benull
)
This is not true, if UIImage
is null
, UIImage.CGImage
will throw NullReferenceException
(will not return null
).
Also in Xamarin.iOS it's possible to get null
CGImage
if UIImage
has been disposed:
UIImage image = UIImage.FromFile(name);
image.Dispose();
// now image.CGImage is null