在由属性强烈定义的 NSMutableArray 中添加对象的正确方法是什么。
[tapBlockView setTapBlock:^(UIImage* image) {
[self.myImageArray addObject:image]; // self retain cycle
}
如果我将创建类似的弱引用
__weak NSMutableArray *array = self.myImageArray;
[tapBlockView setTapBlock:^(UIImage* image) {
[array addObject:image]; // If I will do this then how will I update original Array ?
}
我也试过
__weak id weakSelf = self;
[tapBlockView setTapBlock:^(UIImage* image) {
[weakSelf storeImageInaNewMethod:image]; // Calling SToreImageInaNewMethod
}
和
-(void)storeImageInaNewMethod:(UIImage*)image {
[self.myImageArray addObject:image]; // This again retaining cycle
}
更新由属性定义的原始对象的正确方法是什么?