I downloaded a .jpg file from the Internet with this code:
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://cvcl.mit.edu/hybrid/cat2.jpg"]];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
receivedData=[[NSMutableData data] retain]; // etc etc
Everything works fine. I just don't know how to handle the data. Say I created an image view in IB, how would I go about displaying the image? Here's the last bit:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
// ******do something with the data*********...but how
NSLog(@"Succeeded! Received %d bytes of data",[receivedData length]);
// release the connection, and the data object
[connection release];
[receivedData release];
}