Reputation: 2362
I have a UIView
and I set its frame in my viewDidLoad
. I then use a blurBackgroundForView
function to blur it:
override func viewDidLoad() {
super.viewDidLoad()
view.frame = CGRectMake(0, superView.frame.maxY-height, superView.frame.width, height)
// The view is supposed to peak in from the bottom
AnimationHelper.blurBackgroundForView(view)
}
static func blurBackgroundForView(view: UIView!){
view.backgroundColor = .clearColor()
let blurEffect = UIBlurEffect(style: .Light)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.frame
view.insertSubview(blurEffectView, atIndex: 0)
}
}
The issue is that the background of the UIView
is NOT blurred.
When I move the function call of blurBackgroundView(view)
above the view.frame = ...
I get a blurred view, but the blurred view is much to large.
Upvotes: 1
Views: 1311
Reputation: 484
The frame for blurEffectView should be CGRectMake(0, 0, superview.frame.width, height)
Upvotes: 1