Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the the screen to Blur when presenting a popover in iOS 8

During the talk "ViewController Advancements in iOS8" at WWDC 2014, on slide #114 it shows how the PresentationController can provide a 'dimming view' when a Popover slides up from the bottom when displayed on an iPhone. It doesn't look like the source code for example in the talk is available.

The effect I want is very simple: when a popover slides up, the background of the popover is a blurred 'screen shot' of the contents behind it. The look I am going for is on slide #162. On slide #154 it indicates that the method 'adaptivePresentationStyleForPresentationController' can be used to add a UIVisualEffectView to the 'presented view controller' to get the desired effect.

I have not been able to find a simple Objective-C example showing how this would be done.

like image 424
user1655244 Avatar asked Feb 01 '26 06:02

user1655244


1 Answers

You can add it to your presenting VC before performing the segue to the overlay VC, as follows:

    let blurView = UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffectStyle.ExtraLight))
    blurView.frame = self.view.bounds
    self.view.addSubview(blurView)
like image 150
zooster Avatar answered Feb 02 '26 22:02

zooster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!