swift – 如何设置UIBlurEffectStyle.Light的BlurRadius
发布时间:2020-12-14 06:04:03 所属栏目:百科 来源:网络整理
导读:我想知道如何设置的半径/模糊因子的iOS新的UIBlurEffectStyle.Light?我在文档中找不到任何东西。但我想让它看起来类似于经典的“UIImage ImageEffects.h”模糊效果。 谢谢, required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) let blu
我想知道如何设置的半径/模糊因子的iOS新的UIBlurEffectStyle.Light?我在文档中找不到任何东西。但我想让它看起来类似于经典的“UIImage ImageEffects.h”模糊效果。
谢谢, required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) let blur:UIBlurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light) let effectView:UIVisualEffectView = UIVisualEffectView (effect: blur) effectView.frame = frame addSubview(effectView) }
您可以更改添加模糊效果的UIVisualEffectView的Alpha。
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light) let blurEffectView = UIVisualEffectView(effect: blurEffect) blurEffectView.alpha = 0.5 blurEffectView.frame = self.view.bounds self.view.addSubview(blurEffectView) 这不是一个真正的解决方案,因为它实际上并没有改变模糊的半径,但我发现它得到的工作做非常少的工作。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |