准备你的网址,如下所示。
// Consider this is your prefix url
NSString *urlPrefix = @"https://your_url_prefix/"; // like http://stackoverflow.com/
// Consider this is the array you parsed from the web service
NSArray *resourceArray = @[@"2514466130834f61a9g38d57h0e2cb-25-ProfilePic.PNG", @"26144482598634297156heb8c0dafg-26-ProfilePic.PNG", @"2714464392629h60253gd4ec8b1f7a-27-ProfilePic.PNG", @"2814449113316a7gh5db0e2139c84f-28-ProfilePic.PNG", @"2914454043856e3519ah0dbf27cg84-29-ProfilePic.PNG"];
准备资源URL在您的tableView的数据源方法:cellForRowAtIndexPath
NSString *resourceURL = [urlPrefix stringByAppendingString:[resourceArray objectAtIndex:indexPath.row]];
,并使用SDWebImage
库加载图像,并设置到您的细胞imageView
像
[cell.imageView setImageWithURL:resourceURL];
注:SDWebImage
lib可以从SDWebImage Git下载 将这个库文件添加到您的项目中,导入像下面一样使用。
#import "UIImageView+WebCache.h"
你有一个返回图像文件名列表的web服务?你想下载这些图像并将它们显示在表格中?这个任务有很多部分。你已经完成了哪些,你有哪些困难? – Avi
您是否使用默认单元格的自定义单元?并请分享代码,以便我可以更好地帮助您... –