swift 的图片模糊效果

前端之家收集整理的这篇文章主要介绍了swift 的图片模糊效果前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

@IBOutlet weak var bg: UIImageView!

@IBOutlet weak var logo: UIImageView!

override func viewDidLoad() {

super.viewDidLoad()

// Do any additional setup after loading the view,typically from a nib.

logo.layer.cornerRadius=70;

logo.clipsToBounds=true;

let blureffect=UIBlurEffect(style: UIBlurEffectStyle.Light);

let blurView = UIVisualEffectView(effect: blureffect)

//设置效果视图类实例的尺寸

blurView.frame.size = CGSize(width: view.frame.width,height: view.frame.height)

//将模糊效果视图类实例放入背景中

bg.addSubview(blurView)

}

代码下载地址http://download.csdn.net/detail/bianhuanshizhe/8651677

原文链接:https://www.f2er.com/swift/327229.html

猜你在找的Swift相关文章