问题
I am creating a line for my SKShapeNode using a CGMutablePathRef. Reading up on the usage a bit, I came across a post saying that it's important to use CGPathRelease when you're done using the path. Now I am wondering, when can I release the path? Will releasing it while the SKShapeNode still exists do any harm?
Oh and, sorry if CGPathRelease isn't used anymore since the introduction of garbage collection, I couldn't find out if it still had to be used or not, so please correct me if it's not needed anymore.
回答1:
The node will take ownership of the CGPathRef
when you set its path
property. You can and should use CGPathRelease()
anytime after you're done manipulating the path and have passed it to the node.
来源:https://stackoverflow.com/questions/22464742/where-to-use-cgpathrelease