I want to toggle the blur effect on top of an image I have on my iOS8 app. I know that from the basic idea of this if/else implementation is wrong, but I've got no clue how to do it correctly since I'm new to this. Any recomendation would be gladly accepted.
I'd also like to toggle text on top of the blurred image.
I've got this global constant in my view controller
var cont: Int = 0
And here is the @IBAction related to a button on top of my image.
@IBAction func moreInfo(){
/* First, create the blur effect with the "Dark" style.
All the styles are defined in UIBlurEffectStyle */
let blurEffect = UIBlurEffect(style: .Dark)
/* Then create the effect view, using the blur effect that
we just created. The effect is of type UIVisualEffect */
let blurView = UIVisualEffectView(effect: blurEffect)
blurView.frame.size = CGSize(width: 200, height: 250)
blurView.center = CGPoint(x: 160, y: 250)
/* Toggle blur*/
if (cont == 0){
view.addSubview(blurView)
} else {
/* view.removeFromSuperview(blurView)??? */ //Here should be a way to remove the blur
}
}