简体   繁体   中英

Create custom blur UIView

I have to develop an app that uses aa blur view.

I've tried to use UIVisualEffectView with UIBlueEffect but then I realised that there are just 3 types of blur that you can choose from, without an option to customise the blur.

I need to make a blur that is something between the Light and Dark modes, but I don't know how can I create a custom blur view.

Any idea on how can I do that?

Thank you!

User below code for the blur effect

let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(blurEffectView)

Also you can use below library

https://github.com/ide/UIVisualEffects

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM