This is an agonizingly rookie question, but here I am learning a new language and framework, and I'm trying to answer the question "What is Truth?" as pertains to Obj-C.
I'm trying to lazy-load images across the network. I have a data class called Event that has properties including:
@property (nonatomic, retain) UIImage image;
@property (nonatomic, retain) UIImage thumbnail;
in my AppDelegate, I fetch up a bunch of data about my events (this is an app that shows local arts event listings), and pre-sets each event.image to my default "no-image.png".
Then in the UITableViewController where I view these things, I do:
if (thisEvent.image == NULL) {
NSLog(@"Going for this item's image");
UIImage *tempImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:
[NSURL URLWithString:
[NSString stringWithFormat:
@"http://www.mysite.com/content_elements/%@_image_1.jpg",
thisEvent.guid]]]];
thisEvent.image = tempImage;
}
We never get that NSLog call. Testing thisEvent.image for NULLness isn't the thing. I've tried == nil as well, but that also doesn't work.