【发布时间】:2014-03-28 07:12:29
【问题描述】:
我正在为完成处理程序使用一个块。如何访问块内的imageView/UIElements,
[storyImageView setImageWithURL:[NSURL URLWithString:imageURL] placeholderImage:Nil completed:^(UIImage *storyImage,NSError *error,SDImageCacheType cacheType)
{
//need to access storyImageView inside a block
}];
【问题讨论】:
-
这个问题没有意义。你提到的imageView和“UIElements”,它们是调用块的类的属性吗?
-
imageView 是 UIImageView 的一个实例......如果我们尝试访问 imageView 对象,则会警告在块内捕获 imageView 会导致保留周期
-
你需要创建一个对 imageView 的弱本地引用
标签: ios objective-c uiimageview objective-c-blocks uielement