I got 2 classes
@interface PlayScene : UIView
and
@interface GameOverMenu : PlayScene <UITextFieldDelegate>
in PlayScene I create an instance of GameOverMenu
GameOverMenu* gorm = [[GameOverMenu alloc]initWithFrame:CGRectMake(0, 0, 320, 520)];
gorm.backgroundColor = [UIColor blackColor];
[self addSubview:gorm];
But background is set not for subview but for superview, I mean background doesn’t hide elements of PlayScene view so that buttons and some drawing remain in front of the background
If the problem is still not clear, I want to make my subview stand in front of superview with black(for example) background, covering the whole screen in front of superview.
As if subview class was inherited just from UIView and not from PlayScene
Use any of the below methods :
insertSubview: atIndex:insertSubview: aboveSubview:bringSubviewToFront:EDIT
If you are trying to create an instance of
GameOverMenuwhich is subclass ofPlaySceneand then add this instance as subview on the view ofPlayScene, then probably you can try creating an instance each ofPlaySceneandGameOverMenuand adding these two as subview to a third view.. maybe ViewControllers view or maybe just a view.. based on your requirement…