我想知道如果我做以下情况,这是否考虑泄漏?如何修改代码以使其看起来更干净/更好?
// ClassA
@interface ClassA
CCSprite* image;
@property (nonatomic, retain) CCSprite* image;
@end
@implementation ClassA
@synthesize image;
- (id)init
{
image = [[CCSprite alloc] init];
}
- (void)dealloc
{
[image release];
[super dealloc];
}
@interface Main
@end
@implementation Main
- (id)init
{
ClassA* aObject = [[ClassA alloc] init];
aObject.image = [CCSprite spriteWithFile: @"something.png"];
}
@end