1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
NSString* imageURL = @"http://theurl.com/image.gif"; NSData* imageData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:imageURL]]; UIImage* image = [[UIImage alloc] initWithData:imageData]; [imageView setImage:image]; [imageData release]; [image release]; //or nested version UIImage* myImage = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: @"http://www.mydomain.com/image.png"]]]; [myImageView setImage:myImage]; [myImage release]; |