Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I regulate the level of UIVisualEffectView blur

I'm trying to make a UIVisualEffectView to make a nice blur effect in my view. But I think that the UIVisualEffectView generates a very strong blur.

I'm trying to regulate a level of blur to my UIVisualEffectView, I want a weak blur.

Do you know how to do that?

like image 274
Carl Brusell Avatar asked Oct 02 '14 19:10

Carl Brusell


People also ask

How do you blur the screen in Swift?

Adding a UIBlurEffect In order for UIVisualEffectView to actually blur the content, its superview must be transparent. To make it transparent, change the background color of view to clear . Create a UIBlurEffect with a UIBlurEffect. Style.

How do you blur an image in swift 5?

image = UIImage(ciImage: blurred!) } }

What is Visual Effect view in Swift?

Swift provides with different ways of displaying visual effects like blur and vibrancy effects. These can mostly be used as background for views and can be used to improve the overall app design. You can observe these blur effects throughout iOS like in app library, control center and app dock.


2 Answers

You can't do this with a UIVisualEffectView - the only options for blur are:

enum UIBlurEffectStyle : Int {
    case ExtraLight
    case Light
    case Dark
}

There's no property on UIBlurEffect, UIVisualEffect, or UIVisualEffectView for 'magnitude' of the blur.

This blog post is a good place to start if you want to 'roll your own' blur view with a custom magnitude.

like image 70
Undo Avatar answered Oct 20 '22 01:10

Undo


Also you can use UIImage+ImageEffects.h category from WWDC 2013. It has more stuff to tune

e.g. from https://github.com/ParsePlatform/Anypic/tree/master/Anypic-iOS/Vendor/UIImageEffects

like image 26
kabarga Avatar answered Oct 19 '22 23:10

kabarga