Viesturs Knopkens
Viesturs Knopkens

Reputation: 604

Transparent View color from black to other color?

I noticed that if I set views background color to transparent, the background color turns black (which I guess is default "viewport" color) after segue transition ends.

Can I change that? Of course I could just change color from transparent to purple, but maybe there is a way?

iOS background color

Upvotes: 0

Views: 390

Answers (2)

ChikabuZ
ChikabuZ

Reputation: 10195

You should add this line:

self.navigationController?.modalPresentationStyle = UIModalPresentationStyle.CurrentContext
presentedViewController.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext

Before presenting:

self.presentViewController(presentedViewController, animated: true, completion: nil)

Upvotes: 1

Cyrille
Cyrille

Reputation: 25144

It's the default background color of your UIWindow. Either set it from your app delegate :

self.window.backgroundColor = [UIColor whiteColor];

or by looking up the window of any view currently on-screen, in any view controller:

anyView.window.backgroundColor = ...

Upvotes: 2

Related Questions