Is there another method to add blurred background for a popup without using imageview and taking snapshot of the previous window.
Asked
Active
Viewed 1,189 times
1
-
Possible duplicate of [Creating a blurring overlay view](http://stackoverflow.com/questions/17041669/creating-a-blurring-overlay-view) – 0x416e746f6e Nov 30 '16 at 07:47
4 Answers
1
Its pretty easy.
All you need is a "visual effect view with blur and vibrancy" view. You can add it directly from the Object Library. Just Drag and drop the view. You can set the background colour to clear if needed, And you can set the blur level to light, extra light etc.... Just go through those stuffs

fAiSaL
- 754
- 1
- 10
- 29
1
To add blur view you can use UIBlurEffect.There are 3-4 blur style your can choose from. You can also change alpha of this blur effect in ranges from 0.0 to 1.0 to achieve more accurate blur for your image
To add Blur effect - You can use like view.addBlurEffect
func addBlurEffect() {
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.extraLight)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.alpha = 0.4
blurEffectView.frame = self.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.addSubview(blurEffectView)
}
To Remove blur You can use - To remove blur from UIView view.removeBlurView
func removeBlurView(blurView:UIView){
for subview in blurView.subviews {
if subview is UIVisualEffectView {
subview.removeFromSuperview()
}
}
}

rohit
- 56
- 4
0
You can use UIVisualEffectView
like below
var blurView:UIVisualEffectView = UIVisualEffectView (effect: blur)
blurView.frame = view.bounds
blurView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
popUpView.addSubview(blurView)

Rugmangathan
- 3,186
- 6
- 33
- 44