Populate UIImageView from URL


/ Published in: Objective C
Save to your folder(s)

Populate a UIImageView with an image taken from a URL.


Copy this code and paste it in your HTML
  1. NSString* imageURL = @"http://theurl.com/image.gif";
  2. NSData* imageData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:mapURL]];
  3.  
  4. UIImage* image = [[UIImage alloc] initWithData:imageData];
  5. [imageView setImage:image];
  6. [imageData release];
  7. [image release];

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.