I have what I thought would be a pretty easy thing to accomplish. Basically I have one view controller with some data, let's call it view controller A. When you click a button, I want a second view controller (B) to show up overlaying the first one. However, I don't want B to fully cover A. I want B to be smaller and to basically create a dark transparent background through which you can still see A.
I've tried this through storyboard a lot where I create a segue of type modal and then I played with the presentation options (form, sheet, etc...), but basically always what happens is that the B view controller simply flows up and covers all of A.
There are some guides to doing this in ios 7 and Objective-C, but I haven't been able to manage to translate those to Swift/ios 8 yet (also this is for iPhone).
I'm not sure if anyone has tried this yet in ios 8, but if someone could give me some hints as to how to accomplish this, that would be awesome.
Thanks!
Try the following in prepareForSegue -
toBePresentedVC.view.backgroundColor = UIColor.clearColor()
presentingViewController.modalPresentationStyle = UIModalPresentationStyle.CurrentContext
presentingViewController.presentViewController(self, animated: true completion: nil)
You can try few alpha options with background color to get a transparent effect with some color.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With