I have a UIView
that contains buttons and labels. When these buttons are pressed, this UIView
will become blur using the code below.
@IBOutlet weak var blurView: UIView!
var blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
var blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = blurView.bounds
blurView.addSubview(blurEffectView)
However, I want to remove the blur effect later on.
What is the code for removing the blurred UIView
?
It's hard to know exactly what is going on in your code, as you've clearly posted a cut up version (the last 4 lines are part of a method somewhere, presumably).
You could do something like this to remove all UIVisualEffectView
subviews from your blurView
:
for subview in blurView.subviews {
if subview is UIVisualEffectView {
subview.removeFromSuperview()
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With