is there a way to change the Effect on a UIVisualEffectView? In my App I create a UIVisualEffectView in Storyboards and then I want to change it toLight or Dark on usersettings...
I only see a "initWithEffect" and the "effect" property is readonly :(
So, any Idea on how to solve this?
Thanks, Urkman
Actually there is now possibility to do that!
myVisualEffectView.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
You can animate this!
[UIView animateWithDuration:1.0 animations:^{
myVisualEffectView.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
}];
You can even animate blur add and remove - almost like in Spotlight reaveal on Springboard! Just set style to nil to remove blur effect progressively.
Swift 4 version:
myVisualEffectView.effect = UIBlurEffect(style: .dark)
UIView.animate(withDuration: 1, animations: {
myVisualEffectView.effect = UIBlurEffect(style: .extraLight)
})
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