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 7706469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:07:59+00:00 2026-06-01T00:07:59+00:00

I need to have a new view(w/ ViewController) added over the top of another.

  • 0

I need to have a new view(w/ ViewController) added over the top of another. The user interacts with this new view for a while, and then I want to remove it. In an older version of Xcode I was able to add it as a subview. I now get an EXC_BAD_ACCESS error.

I don’t want the added view as a modal. I need to see the original background through the added view. I’ve read a lot about the new custom containerViews, addChildView, & presentView. I can’t see that any of these are the clear answer.

Here’s the old code that worked before –
Action in the main ViewController:

-(IBAction)showWhiteView:(id)sender
{
    WhiteViewController *whiteView = [[WhiteViewController alloc] initWithNibName:@"WhiteViewController" bundle:nil];
    [self.view addSubview:whiteView.view];
}  

Action in the added view to remove it:

-(IBAction)removeView:(id)sender
{
    [self.view removeFromSuperview];
}

Thanks for your help.

Maybe a VISUAL EXAMPLE will help explain – Let’s say the main view is an ocean, with animated waves and clouds moving controlled by MainView Controller. The user taps something and a I want to add a boat(WhiteView) to the main view. I want the user to interact with boat: tap here the sail opens, tap there the anchor drops, etc. (needing the methods of the WhiteViewController) Eventually I want to remove the boat from the ocean.

Thanks Tim – New code added:

-(IBAction)showWhiteView:(id)sender
{   WhiteViewController *whiteView = [[WhiteViewController alloc] initWithNibName:@"WhiteViewController" bundle:nil];
    [self addChildViewController:whiteView];
    [whiteView didMoveToParentViewController:self];
    [self.view addSubview:whiteView.view];   }

and within the WhiteViewController to remove:

-(IBAction)removeView:(id)sender
{    [self.view removeFromSuperview];
     [self removeFromParentViewController];    }

I look forward to any further suggestions on making this better.
Thanks all!

  • 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-01T00:08:00+00:00Added an answer on June 1, 2026 at 12:08 am

    See the answer here concerning UIViewController containment. I put together an example project on UIViewController containment here: http://github.com/toolmanGitHub/stackedViewControllers

    Hope this helps.“

    Tim

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

Sidebar

Related Questions

I have a new service that I have written and need to register it
I've a lot of Java experience but new to C++. I need to have
I have an old skin that I need to adapt to the new MediaWiki
I have an Excel file that I need to import into a (new) Oracle
I am new to Jquery and need some help: I have a div, I
I have the following three arrays and need to create a new two-dimensional array
I have a dedicated server and I'm in need for building new version of
I have a table into which new data is frequently inserted. I need to
I have situation where I need to change the order of the columns/adding new
I'm new to iOS development but I have a big web development experience, this

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.