以下是这个.m文件的代码   就大神秒解#import "ViewController.h"
#import "MJRefresh.h"
#import "NetManager.h"
#import "UIImageView+WebCache.h"
#import "ToolsCell.h"
@interface ViewController ()
@property (nonatomic)NSArray* allTools;
@end@implementation ViewController- (void)viewDidLoad {
    [super viewDidLoad];
    [self.tableView registerClass:[ToolsCell class] forCellReuseIdentifier:@"Cell"];
    self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        [NetManager getToolsListCompletionHandler:^(NSArray *dataList, NSError *error) {
            self.allTools = dataList;
            NSLog(@"%@",self.allTools);
            [self.tableView reloadData];
            [self.tableView.mj_header endRefreshing];
        }];
    }];
    [self.tableView.mj_header beginRefreshing];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return _allTools.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 60;
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ToolsCell* cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    cell.accessoryType = 1;
    ToolsDic* tool = _allTools[indexPath.row];
    cell.textLabel.text = tool.name;
    [[NSOperationQueue new] addOperationWithBlock:^{
        
        [cell.imageView sd_setImageWithURL:[NSURL URLWithString:tool.name]];
        
        [cell.imageView sd_setImageWithURL:[NSURL URLWithString:tool.icon] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
            [[NSOperationQueue mainQueue] addOperationWithBlock:^{
                
                cell.imageView.image = image;
                
                
            }];
        }];
    }];
    
    return cell;
}
- (void)viewWillAppear:(BOOL)animated{
    [self.tableView reloadData];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}@end

解决方案 »

  1.   

    Cell 初始化方法一下。if !cell {cell = toolcell alloc init……}
      

  2.   

    说明图片已经下载完毕 只是界面没有刷新过来
    NSOperationQueue   不操作UI的东西的
      

  3.   

    在子线程中不进行UI的更新操作,直接使用sd-imag就可以了
      

  4.   

    dispatch_async(dispatch_get_main_queue(), ^{
                    cell.imageView.image = image;
                });
      

  5.   

    把 [[NSOperationQueue new] 去掉
      

  6.   

    直接使用sdwebImage就行!不需要线程
      

  7.   

    [self.tableView registerNib:[UINib nibWithNibName:[ToolsCell class] bundle:nil] forCellReuseIdentifier:@"Cell"];用这样注册比较好,还有block最好弱引用,直接使用sdwebImage就行!不需要线程