Tor
Tor

Reputation: 141

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?

Upvotes: 4

Views: 978

Answers (1)

CodeSmile
CodeSmile

Reputation: 64477

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.

Upvotes: 7

Related Questions