【发布时间】:2013-10-26 21:36:52
【问题描述】:
通过阅读Property vs. ivar in times of ARC,我了解到当我直接获取或设置strong 属性的自动合成关联实例变量但既不会调用自定义getter 或setter 也不会触发KVO 时,ARC 将使用__strong 所有权限定符。
但是,如果我像这样声明一个属性为weak:
@property (weak, nonatomic) id <XYZExampleViewDelegate> delegate;
-
自动合成的关联实例变量会采用
__weak所有权限定符吗?例如,将
_delegate = delegate(vsself.delegate = delegate) 在我的实现中- (id)initWithDelegate:(id <XYZExampleViewDelegate>)delegate根据
__weak资格执行分配? 对于使用
copy声明的属性呢?
【问题讨论】:
标签: objective-c properties automatic-ref-counting weak-references ivar