tweak intensity of blur effect inside UIVisualEffectView in Swift
The radius of the actual UIBlurEffect
cannot change, but there is a workaround.
Changing the alpha
component of the UIVisualEffectView
, will give a subtle blur effect.
let blur = UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffectStyle.Light))
blur.frame = CGRectMake(180, 10, 200, 750)
blur.alpha = 0.4
myView.addSubview(blur)
Swift 3
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.extraLight)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.alpha = 0.4
blurEffectView.frame = self.bounds
self.addSubview(blurEffectView)