當我使用方法加載圖像時,下載圖像後,直到我選擇或滾動單元格時才顯示,但如果我沒有將placeholderImage設置爲零,則效果很好。我不知道有什麼問題。這裏是我的代碼:SDWebImage的一些問題
[cell.imageView sd_setImageWithURL:(my url) placeholderImage:nil];
與SDWebImage一些問題
當我使用方法加載圖像時,下載圖像後,直到我選擇或滾動單元格時才顯示,但如果我沒有將placeholderImage設置爲零,則效果很好。我不知道有什麼問題。這裏是我的代碼:SDWebImage的一些問題
[cell.imageView sd_setImageWithURL:(my url) placeholderImage:nil];
與SDWebImage一些問題
這很奇怪,但你可以在您嘗試[cell setNeedsLayout];
設置圖像以重新加載所有單元格視圖。
我猜你有內部tableView:cellForRowAtIndexPath:
你很好,當我使用這個方法時,它工作的很好:'[cell.imageView sd_setImageWithURL:[NSURL URLWithString:@「http:// pic2。 ooopic.com/01/03/51/25b1OOOPIC19.jpg「] placeholderImage:nil completed:^(UIImage * image,NSError * error,SDImageCacheType cacheType,NSURL * imageURL){cell layoutSubviews]; }];' – hmxxxhhh
但我仍然不知道爲什麼,如果placeholderImage不爲零,即使沒有代碼[cell layoutSubviews],它也能正常工作。 – hmxxxhhh
完工塊的所有調用來改變圖像視圖。
[myImage sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:IMG_PLACEHOLDER] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {}];
在您的項目中使用它並嘗試。
謝謝,我應該在代碼裏面填寫'[cell layoutSubviews]'完成塊。 – hmxxxhhh
你可以嘗試把這個方法放在main_queue上嗎? –
我用過SDWebImage,我看過他的代碼,他用過(dispathch_main_aync_safe) – hmxxxhhh
@CongTran我只試過了cell.imageView有問題 – hmxxxhhh