Sarabjit Singh
Sarabjit Singh

Reputation: 1824

how to fetch image from array and show it on table view

I am fetching image from server and save it on a NSMutableArray. The result of array like that

myarray={"roger_50.jpg",....};

Now i dont know how to access this image on table view.

Upvotes: 0

Views: 240

Answers (2)

Surjit Joshi
Surjit Joshi

Reputation: 3515

Just have proper URL for image in array. And pass it to NSURL object as a link.

 NSURL *imageURL = [NSURL URLWithString:[myarray objectAtIndex : yourindex]];  
 NSData *data = [NSData dataWithContentsOfURL:imageURL];  
 UIImage *image = [[UIImage alloc] initWithData:data];

Have a nice coding. Stay Hungry, Stay Foolish...

Upvotes: 1

B25Dec
B25Dec

Reputation: 2377

i hope the thing you are getting from array are only the names you can retrieve images from server in only two ways i) in nsdata ii)by url of the images on sever .By this way you cann't access the images.

Upvotes: 0

Related Questions