我正在尝试在现有 View 上呈现一个具有模糊透明背景的 View 。我能够在演示动画期间获得所需的效果,但是一旦模糊 View 完全呈现,它就会变得不透明。
我是这样介绍的:
if (!UIAccessibilityIsReduceTransparencyEnabled()) {
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
blurEffectView.frame = self.view.bounds;
[blurEffectView setOpaque:NO];
[self.view insertSubview:blurEffectView atIndex:0];
[blurEffectView setTranslatesAutoresizingMaskIntoConstraints:false];
}
在模糊 View 中,我将背景色设置为透明色,将不透明设置为否。有什么想法吗?
最佳答案
请注意,如果启用“降低透明度”辅助功能设置,任何带有 UIBlurEffect
的 UIVisualEffectView
都将是不透明的。
(设置 > 通用 > 辅助功能 > 增加对比度 > 降低透明度)
(这是您实际使用 if (!UIAccessibilityIsReduceTransparencyEnabled())
语句检查的内容。)
关于带有 UIBlurEffect 的 iOS 8 UIVisualEffect View 变得不透明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28141557/