2014-12-06 82 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

相关问题