Reputation: 67
I am trying to show UIView
after clicking the floating action button. Once, I clicked the floating action button I need to rendering content view.
Now if I try to apply blur effect
, It is not working.
Here is my code:
fileprivate var parentView: UIView!
self.parentView = view
self.items = items
let bounds = self.parentView.bounds
self.contentView = UIView(frame: bounds)
self.blurVisualEffect = UIVisualEffectView(effect: UIBlurEffect(style: .extraLight))
self.blurVisualEffect.frame = self.contentView.frame
self.contentView.addSubview(self.blurVisualEffect)
Upvotes: 2
Views: 1138
Reputation: 1513
try this
let blurEffect = UIBlurEffect(style: .extraLight)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = self. parentView.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.contentView.addSubview(blurEffectView)
Upvotes: 1