Quantcast
Channel: Developer Feed - Snippet
Viewing all articles
Browse latest Browse all 178

How to check if UIImage the is loaded?

$
0
0

Answer

Sometimes when we load the UIImage and try to use it, it does not display or given an exception. The very simple way is to check whether the image handle is null or not as shown below.

UIImage *image = [UIImage imageNamed:@"someImageFile"];

if(!image)

{  NSLog(@"Image Not Loaded");

}

The most common reason this happens is due to incorrect image name specified or the image is not part of the project itself.<!--break-->


Viewing all articles
Browse latest Browse all 178

Trending Articles