【发布时间】:2011-11-10 15:56:22
【问题描述】:
我正在使用 ASIHTTPRequest 从 WCF 中提取 JSON 数据。然后我遍历数据并从 URL 获取图像以显示 UITableView。这种做法在 3G 网络上非常慢。有什么办法可以让它更快!
这是一个示例代码
这段代码将从 URL 中获取图像。这是在 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;
有什么帮助吗?
【问题讨论】:
标签: iphone objective-c uitableview 3g