Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7888547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:51:34+00:00 2026-06-03T05:51:34+00:00

In class @interface StartScene : UIView I call an instance of @interface HelpView :

  • 0

In class

@interface StartScene : UIView

I call an instance of

@interface HelpView : UIView {
    GameOverMenu* gorm;
    PlayScene* tView;
}

and use addSubview. I also got huge code here

-(void) removemyself {
    [tView removeFromSuperview];
    [gorm removeFromSuperview];
    [self removeFromSuperview];
}

-(void)restartPlay {
    [tView removeFromSuperview];
    [self playSceneDidLoad];
}

-(void)gameOverDidLoad {
    [tView removeFromSuperview];
    gorm = [[GameOverMenu alloc]initWithFrame:CGRectMake(0, 0, 320, 520)];
    gorm.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backGround.jpg"]];
    [gorm checkScore:Scores];
    [self addSubview:gorm];
}

-(void)playSceneDidLoad {
    [gorm removeFromSuperview];
    tView = [[PlayScene alloc]initWithFrame:CGRectMake(0, 0, 320, 520)];
    tView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backGround.jpg"]];
    [self addSubview:tView];
    [tView ooneFingerTwoTaps];
}

And two sub classes of HelpView:

@interface PlayScene : HelpView

@interface GameOverMenu : HelpView <UITextFieldDelegate>

In StartScene when I push on a button, an instance of HelpView is created and in init method playSceneDidLoad is called.

Inside the PlayScene there is restart button which calls restartPlay method. When game is lost gameOverDidLoad method is called.

And In both PlayScene and GameOverMenu there are quit button, which calls removemyself method, that are supposed to return player to the main menu.

At first glance it should work fine, but if I press restart button for several times and than try to press Quit, it occurs that the views were not removed from superview, one press on a quit button only now removes them one by one.
And we stop on the HelpView, it didn’t remove itself (even if I try to call [super removeFromSuperview]; somewhere.

I need to remove views correctly in time and to get to the main menu (StartScene) when quit is pressed. I don’t think that a lot of views covering each other is a good variant. What is the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:51:35+00:00Added an answer on June 3, 2026 at 5:51 am

    Well I occurs that the point is that if super class’ method is called from the subclass and there is such a command [self removeFromSuperview]; or [(someOtherSubview) removeFromSuperview];, it is subclass that uses self or (someOtherSubview). If our subclass doesn’t have the pointed subView, than the command would do nothing. And if there is [self removeFromSubview];, subclass would remove itself.

    Actually I solved this problem by using buttons as subView of superclass.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got class @interface PlayScene : UIView with some properties in it (here are
I've got an app with the following class: @interface SearchViewController : UIViewController <UITableViewDataSource, UITableViewDelegate,
I got quite a nice title:) My main class is @interface StartLayer : CCScene
I use this class: @interface NSObject( WiiRemoteDiscoveryDelegate ) - (void) WiiRemoteDiscovered:(WiiRemote*)wiimote; - (void) WiiRemoteDiscoveryError:(int)code;
I have a class: class Base; Also I have an interface class Interface; Next
I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,
Say I have my class @interface Person : NSObject { NSString *name; } I
I have a class /interface hierarchy. On the interface side I have IQuery ISelect
Having these generic interface and class: interface TestIntf<T extends TestIntf<T>> { void test(T param);
Say I have the following Objective-C class: @interface Foo { int someNumber; NSString *someString;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.