0
votes

I'm attempting to present a transparent modal view over another modal view. I'm using storyboards.

I have added this to my first modal view:

self.modalPresentationStyle = UIModalPresentationCurrentContext;

 [self performSegueWithIdentifier:@"sendUserMessage" sender:self];

And this to my second modal view (the one I want to appear over the first modal view having the first transparent in background)

// Make the main view's background clear, the second view's background transparent.
    self.view.backgroundColor = [UIColor clearColor];
    UIView* backView = [[UIView alloc] initWithFrame:self.view.frame];
    backView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
    [self.view addSubview:backView];

But it appears that I cannot interact with my UI, as well as the back screen goes black after it fully loads (although is transparent at first).

I assume it's because I'm doing it from another modal view ?

1

1 Answers

1
votes

The presenting view controller's view will be removed from the window by default.

You can change this by setting the presented view controller's modalPresentationStyle to either UIModalPresentationOverCurrentContext or UIModalPresentationOverFullScreen. Both keep the covered content onscreen.

Edit: The above styles are both introduced in iOS 8. If you want the presenting view controller's view to stay put in iOS 7, you'll have to use the Custom presentation style and provide a transitioningDelegate.