iOS7.x 中的 clipsToBounds 时 UIToolBar 失去半透明

UIToolBar lose translucent when clipsToBounds in iOS7.x

通常我使用 UIToolBar 来伪造实时模糊效果,它对我来说效果很好。但是有一个地方我需要有一个圆角工具栏,但是,每当我设置cornerRadius和clipsToBounds时,半透明(模糊)效果消失了,我的工具栏变得透明。

这是我的代码:

UIToolbar *blurView = [[UIToolbar alloc] initWithFrame:self.bounds];
blurView.barStyle = UIBarStyleBlack;
blurView.layer.cornerRadius = self.height / 2;
blurView.clipsToBounds = YES;
[self insertSubview:blurView atIndex:0];

这里是 clipsToBounds = YES 时的屏幕截图,角变圆了,但模糊消失了。

但是如果我评论clipsToBounds out,模糊效果又回来了,但是角不再圆了。

更奇怪的是这个问题 只发生在 iOS7.x 中,在 iOS8.x 中一切正常,代码完全相同。

以防万一,如果你想知道,这里是它在 iOS8.x 上的样子以及它在 iOS7.x

上的样子

我一直在 Whosebug 上搜索,Google,找不到任何线索。请帮忙!

尝试blurView.layer.cornerRadius = self.height / 2 - 0.5;