标签:
/// 图像缓冲池
@property (nonatomic, strong) NSMutableDictionary *imageCache;
- (NSMutableDictionary *)imageCache {
if (_imageCache == nil) {
_imageCache = [[NSMutableDictionary alloc] init];
}
return _imageCache;
}
image
属性image == nil
时会崩溃=>不能向字典中插入 nilimage == nil
时会重复刷新表格,陷入死循环[[NSOperationQueue mainQueue] addOperationWithBlock:^{
if (image != nil) {
// 设置模型中的图像
[weakSelf.imageCache setObject:image forKey:app.icon];
// 刷新表格
[weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}
}];
标签:
原文地址:http://www.cnblogs.com/donghaoios/p/5089747.html