2014-12-06 118 views
0

我創建活動指示燈視圖 定製細胞與使用我隱藏活動指示燈,當圖像被下載強烈該塊很可能會導致保留週期

[customCell.userPhotoImageView setImageWithURL:[NSURL URLWithString:[[thisNotify user]imageURL]] placeholderImage:nil completed:^ 
(UIImage *image, NSError *error, SDImageCacheType cacheType) 
{ 
    customCell.activityView.hidden = TRUE; 
}]; 

但我執行SDWebImage代碼我看這個警告

捕獲「customCell」強烈該塊很可能會導致保留週期

感謝

回答

0

你可以嘗試這樣的事情只是該塊調用之前:

__weak UICustomCell * weakCustomCell = customCell; 
[customCell.userPhotoImageView setImageWithURL:....^{ 
    weakCustomCell.activityView.hidden = YES; 
}]; 

我認爲這會修正這個錯誤。您只需將一個新的弱引用對象分配給您的單元格,這將防止保留週期。不完全確定其背後的推理,但值得一試。

編輯here's a potential explanation though

相關問題