user2252471
user2252471

Reputation: 289

View Controller Transparent Background

How can I create a view controller with a transparent background that overlays another view controller where the bottom view controller is still visible in iOS 9? The way that works in iOS 8 no longer works.

Upvotes: 2

Views: 2540

Answers (3)

Eden
Eden

Reputation: 1820

FYI: The syntax is now:

        childVC.modalPresentationStyle = UIModalPresentationStyle.OverFullScreen

Upvotes: 0

Alex
Alex

Reputation: 616

First you can set overlaid view controller's background colour as clear colour.

You can use presentViewController method to overlay new view controller.

This from apple docs

When presenting a view controller using the UIModalPresentationFullScreen style, UIKit normally removes the views of the underlying view controller after the transition animations finish. You can prevent the removal of those views by specifying the UIModalPresentationOverFullScreen style instead.

So you can set overlaid view controller's modalPresentationStyle to UIModalPresentationOverFullScreen

I also hope this may be help

When using one of the full-screen presentation styles, the view controller that initiates the presentation must itself cover the entire screen. If the presenting view controller does not cover the screen, UIKit walks up the view controller hierarchy until it finds one that does. If it can’t find an intermediate view controller that fills the screen, UIKit uses the root view controller of the window.

Upvotes: 7

rmd2
rmd2

Reputation: 157

You have to choose the "Cover Vertical" option on the Transition Style on your ViewController.

And on the View inside the ViewController the alpha desired.

To solve this problem you just have to change the Alpha information of your View. To get this view on top of others, change the Transition Style of the ViewController.

Upvotes: 0

Related Questions