Search code examples
objective-cioscocos2d-iphoneremovechild

How to remove a child from inside it if it doesn't know it is child


I got quite a nice title:)

My main class is

@interface StartLayer : CCScene

I used

HelpView* hp = [[HelpView alloc]initWithFrame:CGRectMake(0, 0, 320, 520)];
CCUIViewWrapper* wrapper = [CCUIViewWrapper wrapperForUIView:hp];
[self addChild:wrapper];

to add class

@interface HelpView : UIView

I have got two more classes that have HelpView as their super class

@interface GameOverMenu : HelpView <UITextFieldDelegate>

@interface PlayScene : HelpView

In my GameOverMenu or PlayScene I need to remove HelpView (I guess all of subViews will be removed too) as a child of StartLayer and I totally need HelpView to have UIView as superclass. Any thoughts?


Solution

  • [self.parent removeFromParentAndCleanup:YES] not working ?