Search code examples
iosuiimageviewuiblureffect

ios8 blur effect disappear


Thanks for reading my question I had some trouble stabilizing the intensity of blur effect

I had a UIImageView with blur effect (Extralight) which covered the whole view as a background The intensity of the blur effect looked just fine But after I added items onto the storyboard the blur effect dimmed so much almost disappear

sorry i don't have enough reputation to upload pictures

anyone know what caused it, and how to solve?

Thank you very much!

override func viewDidLayoutSubviews() {                  
    // set bg image and blur         
    bg.image = UIImage(named: "my portrait")         
    var blurEffect = UIBlurEffect(style:      UIBlurEffectStyle.ExtraLight)         
    var blurView = UIVisualEffectView(effect:     blurEffect)         
    blurView.frame = bg.bounds                  
    bg.addSubview(blurView) 
}

Solution

  • I think I found the reason It is because the blur view is added under function ViewDidLayoutSubview So the blur is added multiple times That's the reason it's looks dimmer and dimmer