Adjust the hardness of the blur effect in iOS 8

I use the blur effect on the image in iOS 8, and I wonder if it can be quickly said how strong the blur effect will be.

This is the code.

var blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark) var visualEffectView = UIVisualEffectView(effect: blurEffect) as UIVisualEffectView visualEffectView.frame = imageView.bounds imageView.addSubview(visualEffectView) 
+6
source share
1 answer

This is currently impossible to do, you can change the alpha level of the blur itself, but it will give you a warning about graphical errors and may not always work perfectly.

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIVisualEffectView/

Setting the correct alpha value

When using the UIVisualEffectView class, avoid alpha values ​​that are less than 1. Creating views that are partially transparent causes systems to combine the view and all its associated views during the offscreen render pass. UIVisualEffectView objects must be combined as part of the content that they overlay on top to look true. Setting the alpha function less than 1 on the visual effect or any of its observations causes many effects that look incorrect or not displayed at all.

The best solution that I know of is to use something like FxBlurView , where you can change the β€œblurRadius” for the effect you are requesting, It seems that nothing improves performance than the implementation of apples, but third-party libraries will be enough if you Do not plan to manipulate blur boundaries during animation.

0
source

Source: https://habr.com/ru/post/983145/


All Articles