我有一个UIView
,我将它的框架设置在我的viewDidLoad
. 然后我使用一个blurBackgroundForView
函数来模糊它:
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)
}
}
问题是背景UIView
不是模糊的。blurBackgroundView(view)
当我移动上面的函数调用时,view.frame = ...
我得到了一个模糊的视图,但模糊的视图非常大。