UIBlurEffect
UIBlurEffect will provide a blur that appears to have been applied to the content layered behind the UIVisualEffectView. Views added to the contentView of a blur visual effect are not blurred themselves.
- UIBlurEffect需要结合UIVisualEffectView来使用
- UIBlurEffect会生成一个透明滤镜,作用于UIVisualEffectView底下的所有视图,不包括UIVisualEffectView本身的子View。
- UIBlurEffect并没有提供公开的API来调整模糊半径
先通过KVC私有方法来查看默认的模糊半径:
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
id effectSettings = [effect valueForKeyPath:@"effectSettings"];
NSLog(@"effectSettings: %@", effectSettings);
输出:
effectSettings: <_UIBackdropViewSettingsLight : 0x7f891c706df0>
graphicsQuality: 100
backdrop visible: YES
grayscaleTintLevel: 1.00
grayscaleTintAlpha: 0.30
grayscaleTintMaskImage: (null)
grayscal

本文介绍了如何在iOS中使用UIBlurEffect创建模糊效果,并探讨了UIBlurEffect的Radius修改问题。由于UIBlurEffect没有公开API调整模糊半径,通过KVC尝试修改会导致崩溃。文章提出了一种通过继承和扩展UIBlurEffect来动态更新Radius的解决方案,但这种方法可能涉及审核风险。

677

被折叠的 条评论
为什么被折叠?



