swiftgaussianblurryuiblureffectuivisualeffectview

tweak intensity of blur effect inside UIVisualEffectView in Swift


I'm using this code to create a blur effect inside my view:

let blur = UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffectStyle.Light))
blur.frame = CGRectMake(180, 10, 200, 750)
myView.addSubview(blur)

is there any way to tweak the gaussian function producing the blur in order to achieve different level of "out of focus" effect?


Solution

  • Since there is no other parameter in UIBlurEffect , I think the only way is to use the CIFilter preset CIGaussianBlur to blur the background View and use its key inputRadius to adjust the level.
    If you want to achieve the same effect as so called light/dark/ExtraLight, you can compose this filter with other filters.