Tuesday, May 10, 2011

Get UIImage from NSString URL

To get an image from Internet, you can load the image with NSURL as NSData and then init the UIImage with the NSData.

 NSData * imageData = [[NSData alloc] initWithContentsOfURL: 
                                       [NSURL URLWithString:
                                        @"http://graph.facebook.com/seymores/picture"]];
 self.image = [UIImage imageWithData: imageData];
 [imageData release];

No comments: