Search code examples
iphoneobjective-cuitableview3g

How to load image faster in iPhone?


I'm using ASIHTTPRequest to pull the JSON data from WCF. I then looping through the data and fetching image from a URL to display UITableView. This practice is extremely slow on 3G network. Is there anything that I can do to make it faster!

Here is a sample code

This pice of code will grab image from the URL. This is under tableView cellFroRowAtIndexPath:

// Add image
NSString* trimmedCode = [[courseList objectAtIndex:indexPath.row] stringByReplacingOccurrencesOfString:@" " withString:@""];
NSString *imageName = [NSString stringWithFormat:@"http://www.someURL.com/images/%@.png", trimmedCode];
NSURL *url = [NSURL URLWithString: imageName];
cell.myImage.image = [UIImage imageWithData: [NSData dataWithContentsOfURL:url]];

return cell;

Any help?


Solution

  • I found a similar question on Stackoverflow, which address my answer. More specific answer to my question is, I'm using the SDWebImage library. Which is much simpler to use! Thank you for all of your support.