0
votes

I recently made a menu screen to my cocos2d app where I have attached two pickerviews to the UIWindow. Everything works good, but when I go to select which "game" I want to play and the scene changes, the pickerviews remain. How can I remove them?

Thanks!

More info:

The button is a CCMenuItem (if that matters)

Edit: And this is how Im changing the scene once a button is pressed.

[[CCDirector sharedDirector] replaceScene:menuScene];

2

2 Answers

1
votes

If a CCNode object (like CCMenuItem) remains on screen after changing scenes, you have a memory leak.

You're saying that you attach the views (CCMenuItem?) to the UIWindow. I can't imagine how that would work since CCNode objects are not UIView objects.

One of those two issues is likely to be your problem, but hard to give you a concrete fix without seeing the relevant code sections.

0
votes

I figured it out, all I did was give each pickerview a unique tag, and then when my button is pressed, I used [UIView removeFromSuperview: tag]; for each picker view.