I am setting a background image to view controller. But also i want to add blur effect to this background. How can I do this?
I am setting background with following
@AlvinGeorge should just use:
extension UIImageView{
func blurImage()
{
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = self.bounds
blurEffectView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] // for supporting device rotation
self.addSubview(blurEffectView)
}
}
usage:
blurredBackground.frame = self.view.bounds
blurredBackground.blurImage()
self.view.addSubview(self.blurredBackground)