swift cancel blur effect slowly

322 Views Asked by At

I'm trying to unblur my image slowly, i blurred it with this code

 let blur = UIBlurEffect(style: UIBlurEffectStyle.light)
        let blurView = UIVisualEffectView(effect: blur)
        blurView.frame = imageview.bounds
        imageview.addSubview(blurView)

then i tried to unblur my image with this code :

UIView.animate(withDuration: 6.0) {
            blurView.alpha = 0.5
}

The problem is that there is no effect going on, the image is loading with 0.5 alpha.

1

There are 1 best solutions below

0
Korken55 On BEST ANSWER

The problem was that my unblur effect was in the viewDidLoad Method, i had to put it in the viewDidApper Method.