我正在阅读 Apple 发布的LazyTableImages 代码,他们为此做了一些事情(在 NSOperation 子类中):
- (void)dealloc {
[myProperty release];
[myProperty2 release];
}
- (void)main {
//
// Parse operation undertaken here
//
self.myProperty = nil;
self.myProperty2 = nil;
}
我的想法是,如果 dealloc
在将属性设置为 nil 之前调用它们,他们会这样做。
我的想法在这里正确吗?发布是不必要的,因为self.myProperty = nil
有效发布myProperty
?
我在这段代码中注意到的一件事是它们并没有release
全部保留 中的对象dealloc
,只有其中一些,这确实是我感到困惑的原因。
干杯