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)
grayscaleTintMaskAlpha: 1.