简体   繁体   English

如何在Swift中将UIImageView置于“模糊效果”之上?

[英]How do I make my UIImageView be on top of the Blur Effect in Swift?

I have this camera app im working on and once the picture is taken the view gets blurred including the captured image. 我正在使用此相机应用程序,正在拍摄照片后,视图变得模糊,包括捕获的图像。 I would like the captured image to be on top of the blur effect so It doesnt get blurred and the user could be able to see the picture they took. 我希望捕获的图像位于模糊效果之上,这样它就不会变得模糊,用户可以看到他们拍摄的照片。 How would I be able to do that? 我该怎么做? This is the code I have currently: 这是我目前拥有的代码:

if !UIAccessibilityIsReduceTransparencyEnabled() {
    self.view.backgroundColor = UIColor.clearColor()

                let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
                let blurEffectView = UIVisualEffectView(effect: blurEffect)
                blurEffectView.frame = self.view.bounds
                blurEffectView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]

                self.view.addSubview(blurEffectView) 



                    } 
                    else {
                        self.view.backgroundColor = UIColor.blackColor()
                    }

Any views added to the effect views content view will not be blurred. 添加到效果视图内容视图的任何视图都不会模糊。 Any views behind the effect view will be blurred. 效果视图后面的任何视图都将被模糊。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM