I added a child like this inside of a CCLayer:
[self addChild:object1];
Later on I want to remove that object from the children. Ummm so how do I do that? Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your question leads me to believe you don’t know the cocos2d API reference:
http://www.cocos2d-iphone.org/api-ref/
To remove object1 simply use this:
If you don’t keep a reference of object1 around you can remove it by tag, which means you’ll have to give it a tag first:
To remove it:
I’ve added this Q&A to my cocos2d FAQ, please find more details to this answer here:
http://www.learn-cocos2d.com/knowledge-base/cocos2d-iphone-faq/learn-cocos2d-public-content/manual/cocos2d-general/14824-how-to-remove-a-child-from-the-nodescenelayer