Breaking News
Home / iOS / iOS Snippets / How to check if UIImage the is loaded?

How to check if UIImage the is loaded?

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.<!>

[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Leave a Reply