philfreo philfreo - 6 months ago 21
Objective-C Question

iPhone: How to get a UIImage from a url?

How do you download an image and turn it into a UIImage?

Answer
NSURL *url = [NSURL URLWithString:@"http://example.com/image.jpg"];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[[UIImage alloc] initWithData:data] autorelease];

However, this isn't asynchronous.