Reputation: 4103
I'm using this code to set an image in an UIImage view
UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://farm4.static.flickr.com/3092/2915896504_a88b69c9de.jpg"]]];
[self.ImageView setImage:image];
NSLog(@"image set");
The log-statement is displayed in the console so the code is executed. I've made sure that an UIImageView is hooked up to self.ImageView
The image is not displayed in the UIImageView. What can I do to make this work?
Upvotes: 0
Views: 3980
Reputation: 104698
Try sanity checking it:
UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://farm4.static.flickr.com/3092/2915896504_a88b69c9de.jpg"]]];
assert(image && "error reading the image");
assert(self.ImageView && "there is no image view");
[self.ImageView setImage:image];
NSLog(@"image set");
Upvotes: 1