I've been trying to implement the blur effect using an UIImageView in xcode 6 (swift language), I'm trying to implement it so everything that is below the ImageView get blurred.
I cannot make it work, so I'm asking you guys from stack overflow to help me, please.
How can that be done?
the code I wrote so far is:
class blurImage: UIImageView {
init(frame: CGRect) {
super.init(frame: frame)
var blur:UIBlurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light)
var effectView:UIVisualEffectView = UIVisualEffectView (effect: blur)
}
}
You need to assign a frame to effect blur view and add it as subview
class blurImage: UIImageView {
init(frame: CGRect) { super.init(frame: frame) var blur:UIBlurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light) var effectView:UIVisualEffectView = UIVisualEffectView (effect: blur) effectView.frame = frame addSubview(effectView) } }
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