Hello friends,
To add blur effect in swift you may use the following code:
IBAction func blurImage(sender: AnyObject) {
// 1 Create an object of UIBlurEffect,you may change the value of style as per your requirement
var darkBlur = UIBlurEffect(style: UIBlurEffectStyle.Dark)
// 2Create an object UIVisualEffectView with the object of UIBlurEffect
var blurView = UIVisualEffectView(effect: darkBlur)
blurView.frame = imageView.bounds
// 3 Add the blurview to the imageview or any other object you want to blur
imageView.addSubview(blurView)
}
0 Comment(s)