【发布时间】:2010-12-06 19:53:26
【问题描述】:
我在现有类上有一个类别,它向该类添加了一个属性和一些方法。
@interface AClass (ACategory) {
NSString *aProperty;
}
@property (nonatomic, retain) NSString *aProperty;
@end
在实现文件中,我想在对象被释放的时候释放这个属性。但是,如果我在这个类中声明dealloc,它将根据我的理解覆盖原始类中的 dealloc。那么当对象被释放时释放这个aProperty的正确方法是什么?
@implementation AClass (ACategory)
@synthesize aProperty;
- (void)dealloc {
[aProperty release];
// this will skip the original dealloc method from what I understand
[super dealloc];
}
@end
【问题讨论】:
标签: objective-c dealloc objective-c-category