UITableViewCell 使用 SDWebImage 后图片显示不正常

rollrock1987 2016-01-29 03:22:33
主要代码如下:

viewController代码:
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * cellId = @"ROCKTableViewCell";

ROCKTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellId];

if( !cell )
{
cell = [[[NSBundle mainBundle] loadNibNamed:cellId owner:self options:nil] lastObject];
}

[cell refresh:_array[indexPath.row]];

return cell;
}


///ROCKTableViewCell 代码

-(void)refresh:(NSString*)url
{
[self.imageView sd_setImageWithURL:[NSURL URLWithString:url]];
}

现在出现的情况是,要滚动uitableview或者点击 viewCell才能显示图片,请问这个是为什么?
...全文
325 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
oxxther_ios 2016-01-30
  • 打赏
  • 举报
回复
滚动能显示图片说明图片已经缓存成功,这情况其实就是表视图(数据还没读上去时)先显示了,图片缓存完后,显示到cell上时,应该对表视图,进行刷新[self.tableView reloadData].
??20 2016-01-30
  • 打赏
  • 举报
回复
imageView没有frame

29,031

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧