A modal UIViewController with transparency
Cheat sheet: how to present a UIViewController over another one so that it is semi-transparent and the content underneath shows through.
In Storyboard, set the Segue Kind field to «Present Modally». For the UIViewController you are showing, set the background color to Clear Color, then create an inner background (an image or another UIView) with an alpha value, for example 0.5.
In code:
self.performSegueWithIdentifier("segueName", sender: self)
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "segueName" {
let vc = segue.destinationViewController as! YourViewController
vc.modalPresentationStyle = .Custom
}
}
// ─── EOF ──────────────────────────────────────────────────