问题描述
我正在使用UIVisualEffectView来模糊SpriteKit中的屏幕区域,如下所示:
I'm using a UIVisualEffectView to blur a section of the screen in SpriteKit like so:
let blur:UIBlurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
let UIEffectView:UIVisualEffectView = UIVisualEffectView(effect: blur)
UIEffectView.frame = CGRectMake(0, 0, frame.width, frame.height * 0.15)
self.view?.addSubview(UIEffectView)
但是它显示为灰色阴影区域而不是模糊区域.奇怪的是,它模糊了,而GameCenter通知却在开始时显示,说欢迎回来,(玩家)",但是一旦通知消失,它就会变成一个灰色框.
But it appears as a grey shaded area instead of a blur. Strangely, it blurs whilst the GameCenter notification shows at the start, saying "Welcome back, (player)" - but once the notification disappears, it goes back to being a grey box.
同样适用于在iOS9中进入多任务视图时,预览区域模糊,但是在进入应用程序时,它又恢复为灰色阴影区域.
Same applies to when you go into the multi-task view in iOS9, the preview has the section blurred, but when you go into the app, it reverts to being a grey shaded area again.
有什么想法为什么会这样?在模拟器和物理硬件中,它的作用相同.
Any ideas why this is happening? It does the same in the simulators as well as physical hardware.
推荐答案
在,事实证明,当您将UIKit
和SpriteKit
弄混时,可能会发生奇怪的事情.我建议使用SKEffectNode
而不是UIVisualEffectView
来执行模糊工作.
这篇关于UIVisualEffectView创建一个灰色框而不是模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!