I have a custom CCNode
class that has a bunch of children nodes, and I want to keep references to the children in order to make some custom transitions.
For instance for the child background the custom class would look like this:
@interface MyNode : CCNode
@property (nonatomic, strong) CCNode *background;
@end
@implementation
- (void)setBackground:(CCNode *)background {
if (_background) {
[self removeChild:_background];
}
if (background) {
[self addChild:background];
}
_background = background;
}
- (void)runTransition {
if (_background)
[_background runAction:[…]];
}
@end
The problem is that this causes a retain cycle on ARC with the node background never being freed from memory.