Take the tour ×

I'm using the following code to fetch some images, that are going into a tableview. But it takes ages (5-6 seconds) to get the 30 images in.

Is there a smarter/faster way to do this?

NSString *imageUrl = ......;
NSString *urlStr = 
[imageUrl UrlstringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *path = [[NSString alloc] initWithFormat:@"http://xxx.dk/xml.aspx%@", urlStr]; 
NSURL *url = [NSURL URLWithString:path];

NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];
return img;
[..... release];
share|improve this question
add comment

3 Answers

Here profileimg is an get from Api ,String name;

NSString *profileimg=[Check objectForKey:@"IMAGE"];

imageview.image=[[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:profileimg]]]

share|improve this answer
add comment

I'd rather download every new image in array of images when a cell appears on the screen and just display already saved image if a cell appears on the screen for the second time (i.e. image for this cell has been already downloaded).

share|improve this answer
add comment

use asynchronize loading of image. check out this sample code : http://developer.apple.com/library/ios/#samplecode/LazyTableImages/Introduction/Intro.html

share|improve this answer
add comment

Your Answer


