Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does removeFromParent on SKNode destroy the instance?

Reading Apple's documentation about removeFromParent it says:

"Removes the receiving node from its parent."

Does this mean the node is destroyed? Do I need to set the node to NULL for its memory to be freed?

like image 720
Tor Avatar asked Mar 20 '23 13:03

Tor


1 Answers

An object (under ARC) is released when there is no strong reference holding on to it. A node being a child is a strong reference, removing the node will usually release the node unless there is a strong reference to it elsewhere.

You can easily verify this by implementing -(void) dealloc and setting a breakpoint or NSLog statement in it.

like image 120
LearnCocos2D Avatar answered Mar 31 '23 23:03

LearnCocos2D