Ios SDWebImage的几个问题
当我使用加载图像的方法时,图像下载后,在我选择或滚动单元格之前,它不会显示,但是如果我没有将占位符图像设置为nil,它工作得很好。我不知道你怎么了。这是我的密码:Ios SDWebImage的几个问题,ios,sdwebimage,Ios,Sdwebimage,当我使用加载图像的方法时,图像下载后,在我选择或滚动单元格之前,它不会显示,但是如果我没有将占位符图像设置为nil,它工作得很好。我不知道你怎么了。这是我的密码: [cell.imageView sd_setImageWithURL:(my url) placeholderImage:nil]; SDWebImage的一些问题您可以使用另一种方法来执行此操作,例如: [_theImageView sd_setImageWithURL:[NSURL URLWithString:_imageUrl
[cell.imageView sd_setImageWithURL:(my url) placeholderImage:nil];
SDWebImage的一些问题您可以使用另一种方法来执行此操作,例如:
[_theImageView sd_setImageWithURL:[NSURL URLWithString:_imageUrl]]
这很奇怪,但是你可以试试
[cell setNeedsLayout]代码>将图像设置为重新加载所有单元视图后
我猜所有的调用都在tableView:cellForRowAtIndexPath:
使用完成块来更改图像视图
[myImage sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:IMG_PLACEHOLDER] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {}];
在您的项目中使用此方法并尝试。您可以尝试将此方法放在主队列上吗?我使用了SDWebImage,我看到了他的代码,他使用了(dispathch_main_aync_safe)@CongTran我只尝试了单元格。imageView出现了问题。您可以尝试删除dispathch_main_aync_safe
块,让我们在外部编写它。也许…很抱歉,它也有同样的问题。@hmxxxhhh哦,看起来很奇怪,请确保您的tableview是否有一些问题您是正确的,当我使用此方法时它工作得很好:'[cell.imageView sd_setImageWithURL:[NSURL URLWithString:@“placeholder image:nil completed:^(UIImage*image,NSError*error,SDImageCacheType,NSURL*imageURL){[cell layoutSubviews];}];'但我仍然不知道为什么,如果占位符图像不是零,即使没有代码[cell layoutSubviews],它也能正常工作。谢谢,我应该在完成块的代码[cell layoutSubviews]
中。