【发布时间】:2013-05-14 08:57:51
【问题描述】:
我正在使用 AFNetworking 从服务器下载图像,一切正常,但除非我滚动表格视图,否则图像不会出现。这是我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell*cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
//configuring news feed
dictionary = [newsFeed objectAtIndex:indexPath.row];
//display thumbnails
UIImageView *image = [[UIImageView alloc]init];
[image setImageWithURL:[NSURL URLWithString:[dictionary objectForKey:@"image"]]placeholderImage:[UIImage imageNamed:NEWSAVATAR]];
cell.imageView.image = [image.image imageScaledToSize:CGSizeMake(55, 55)];
[cell setNeedsLayout];
return cell;
}
【问题讨论】:
-
可能是因为您的单元格正在出队,您能否提供整个
cellForRowAtIndexPath:代码,或者至少初始化单元格部分 -
@Bonnie 我编辑我的帖子
标签: iphone ios objective-c networking afnetworking