Mohamed Elzarei
Mohamed Elzarei

Reputation: 41

Get image from Webpage

What I am trying to do is to get image from that url www.floraphotographs.com/showrandomiphonestuff.php?color=red&session=5345

The site displays a random image everytime , I need to be able to get the image in a NSImage object and display on the screen

Upvotes: 0

Views: 85

Answers (1)

Daniel
Daniel

Reputation: 1198

Grab the data like so:

NSURL * url = [NSURL URLWithString:@"http://www.flora...."];
NSData * data = [NSData dataWithContentsOfURL:url];

Then stick it in a UIImage:

UIImage * image = [UIImage imageWithData:data];

Then put it in a UIImageView:

imageView.image = image;

Upvotes: 1

Related Questions