【发布时间】:2017-12-07 00:59:13
【问题描述】:
我已经实现了 AFNetworking 以将图像异步下载到我的表格中,一切正常,但是当我向下滚动表格时,单元格中的图像会缩小。
我的代码如下所示:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
NSDictionary *dictionary = [self.json objectAtIndex:indexPath.row];
cell.textLabel.text=[dictionary objectForKey:@"name"];
cell.detailTextLabel.text = [dictionary objectForKey:@"description"];
NSString *path = [[[[dictionary objectForKey:@"images"] objectAtIndex:0] valueForKey:@"thumb"] valueForKey:@"url"];
NSString *ruta = [NSString stringWithFormat:@"http://18.221.78.126/ecoferia%@",path];
NSURL *url = [NSURL URLWithString:ruta];
[cell.imageView setImageWithURL:url
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
return cell;
}
这里有一些截图:
任何提示都会有所不同。 问候。
【问题讨论】:
标签: ios objective-c uitableview afnetworking