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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:50:22+00:00 2026-06-04T07:50:22+00:00

I am using presentModalViewController to try and display a UIView on top of some

  • 0

I am using presentModalViewController to try and display a UIView on top of some other views. I call presentModalViewController from controller1. I am trying to display views from controller2.

From controller1 I call controller2 as follows:

- (void) someButtonPressed: (id)sender
{
    MyController* controller2 = [ [ MyController alloc ] initWithNibName:nil bundle:nil ];

    [self presentModalViewController:controller2 animated:YES];
    //[self presentViewController:controller2 animated:NO completion:nil ];
}

In controller2 I then do this:

- (void)viewDidLoad
{
    [super viewDidLoad];
    if (YES){

        UIWindow* keyWindow = [[UIApplication sharedApplication] keyWindow];
        UIView* master = (UIView*)[keyWindow viewWithTag:100]; // Master is the entire app, but always oriented so top left corner is 0,0.

        UIView* newView = [ [ UIView alloc ] initWithFrame:CGRectMake(100, 100, 400, 400) ];

        [self setView:newView ];

        self.view.backgroundColor = [ UIColor clearColor ];
    }

}

The problem is that none of the content from the first controller shows through. I want the previous views to remain visible. Is there any way to make the views from the second controller clear of invisible? The reason I want to do this is because I want the second controller/view to display a transparent layer that will catch all touch events without them getting through to the views managed by controller1.

Thanks very much.

  • 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-04T07:50:23+00:00Added an answer on June 4, 2026 at 7:50 am

    Add the view as a sub view, that will work:

    - (void) someButtonPressed: (id)sender
    {
        MyController* controller2 = [ [ MyController alloc ] initWithNibName:nil bundle:nil ];
    
        [[self view] addSubview:[controller2 view]];
        // [controller2 release] if you aren't using ARC
    
        //[self presentModalViewController:controller2 animated:YES];
        //[self presentViewController:controller2 animated:NO completion:nil ];
    }
    

    If you are using viewDidAppear in controller2, place this line after the addSubView line:

    [controller2 viewDidAppear:NO]
    

    Same goes for other viewDid methods 😉

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

Sidebar

Related Questions

I am trying to call up a modal table view controller using presentModalViewController but
I Show a view using presentModalViewController . and from this UIView I want to
I am trying to display a login screen using presentModalViewController on iPad. LoginFormController *controller
I have a problem, using presentModalViewController to display a UIView. Within the Application I
I want to display a popup window in iPad using the UIView's presentModalViewController method
I'm trying to present a UIImagePickerController from a UITableViewController subclass using the following code:
I am using presentModalViewController to display a view which allows the user to modify
I add a viewcontroller using [self presentModalViewController:vectorView animated:YES]; But then from within would like
so i am using presentmodalviewcontroller to change the active views in an ipad app.
In my app I am changing views using presentModalViewController, then release the new view

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.