Sunday, June 3, 2012

iOS: Easy Way to Download an Image From a Link

UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:@"http://www.xxxxxxxx.com/image.png"]];

Only caveat is that this takes place synchronously, which is bad in most cases. If you're in the UI thread, you might want to do this in a separate thread, or use the NSURLConnection API.

No comments:

Post a Comment