Adding Image to a UIImageView using Image URL

By | March 14, 2011

Hi,

Sometimes you need to add Image to a UIImageView from the URL of the image you got. In that case, this is how you can add image to the UIImageView.

NSString *picURL= @"http://photobucket.com/yourImage.gif";
NSData *picData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:mapURL]];
UIImage* picture = [[UIImage alloc] initWithData:picData];
[pictureView setImage:picture];
[picData release];
[picture release];

Here, pictureView is your UIImageView.
🙂

Leave a Reply

Your email address will not be published. Required fields are marked *