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

  • SEARCH
  • Home
  • 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 7066005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:01:46+00:00 2026-05-28T05:01:46+00:00

I have added a few buttons to self.view. When the user clicks on one

  • 0

I have added a few buttons to self.view. When the user clicks on one button, i will load another view (subView). My code where i am loading the subView is shown below

subView = [[UIView alloc] initWithFrame:CGRectMake(0,0,self.scrollView.contentSize.width, self.scrollView.contentSize.height)];
subView.tag=1;
// and then i add various other components to it

[self.view addSubview:subView]; // and finally add it to the view

When the user touches this view, i detect it and remove the view (i have already done the detection part).

This is how i am removing the view

UIView *v = [self.subView viewWithTag:1];
    v.hidden = YES;
    [v endEditing:YES];
 [v removeFromSuperview];

The view dissapears, but i can’t click on the buttons or anything that was on the self.view. When i hold the mouse cursor on a button for awhile i could click it otherwise i can’t. How can i solve this ?

  • 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-05-28T05:01:47+00:00Added an answer on May 28, 2026 at 5:01 am

    I think your problem is that you do

    [self.subView viewWithTag:1];
    

    but the view you want to remove is “owned” by self.view so it should be

    [self.view viewWithTag:1];
    

    But if you have a reference to subView, why search it again? Why not immediately:

    self.subView.hidden = YES;
    [self.subView endEditing:YES];
    [self.subView removeFromSuperview];
    

    Btw you might want to look into your memory management, I see you alloc your subView but I don’t see it being released, when the view is removed again. Maybe you do and you just don’t show the code, in that case forget my comment.

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

Sidebar

Related Questions

I have added buttons to my expanded notification, there are quite a few. The
I have added a few buttons to the right side of the navigation bar
I have a root view controller which has few buttons. On click of these
I already have a view controller with a default view and few things added
I have a few custom UITableViewCells - http://img11.imageshack.us/i/customfacilitiescell.png/ which are added to this UIViewController
I have added some code which compiles cleanly and have just received this Windows
I have added some dynamic textboxes upon a button click. I need the values
I have assigned macro to few buttons. How can I find out inside macro
I have created an accordion layout and added a few panels as shown to
We have a form which has a few separate submit buttons which do different

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.