Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Does presentModalViewController:animated: Turn The Background Black?

I am using presentModalViewController:animated: and while functionally it works correctly visually it has an artifact I want to remove. When the modally presented viewController appears its parent viewController is completely hidden with the background turning black. This is not what I want. My child viewController's view is translucent and I want to reveal the parent viewControllers view behind it. The effect I want is a piece of tracing paper sliding over the background.

I assumed presentModalViewController:animated: supported this. Is that not the case?

Thanks,
Doug

like image 591
dugla Avatar asked Dec 02 '22 01:12

dugla


1 Answers

NavigationController and the View Controllers are designed in such a way that only one view controller may show at a time. When a new view controller is pushed/presented the previous view controller will be hidden by the system. So when you reduce the modal view's alpha you will possibly see the window's backgroundColor (the black color you see now).

If you want a translucent view to slide-in over the main view, you can add the view as the subView of main view and animate it using UIView Animations.

like image 140
EmptyStack Avatar answered Dec 03 '22 14:12

EmptyStack