Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在swift中使UIViewcontroller透明?clear()不';行不通_Swift_Uiviewcontroller - Fatal编程技术网

如何在swift中使UIViewcontroller透明?clear()不';行不通

如何在swift中使UIViewcontroller透明?clear()不';行不通,swift,uiviewcontroller,Swift,Uiviewcontroller,我有一个问题:如何使UIviewcontroller透明。我想将iPhone的背景图像作为我的应用程序的背景图像 我想制作一个类似于此sujet的界面: 代码运行得非常好: if !UIAccessibilityIsReduceTransparencyEnabled() { self.view.backgroundColor = UIColor.clearColor() let blurEffect = UIBlurEffect(style: UIBlurEff

我有一个问题:如何使UIviewcontroller透明。我想将iPhone的背景图像作为我的应用程序的背景图像

我想制作一个类似于此sujet的界面:

代码运行得非常好:

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

        let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light)
        let blurEffectView = UIVisualEffectView(effect: blurEffect)
        //always fill the view
        blurEffectView.frame = self.view.bounds
        blurEffectView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]

        //self.view.addSubview(blurEffectView) //if you have more UIViews, use an insertSubview API to place it where needed
        self.view.insertSubview(blurEffectView, atIndex: 0)
    }
    else {
        self.view.backgroundColor = UIColor.clearColor()
    }
但是在
self.view.backgroundColor=UIColor.clearColor()
之后,我的应用程序的背景总是白色的…背景不是透明的

我想让应用程序的背景透明,以显示iPhone的图像背景,怎么做

PS:我有第二个解决方案,将iPhone的背景图像显示为我的应用程序的背景图像,它是获取iPhone的背景图像…但是在启动应用程序之前,我如何获取iPhone的背景图像


谢谢大家。

视图控制器不能是透明的……或任何颜色。它们不是可见的对象,而是视图。(我不想在这里小题大做。当你试图找到有用的答案时,会有很大的不同。)谢谢你的回答。然后,如何将iPhone的背景图像作为应用程序的背景图像?如何获取Iphone的背景图像?非常感谢。我不认为你试图在非越狱设备上执行的操作是可能的。视图控制器不能是透明的…或任何颜色。它们不是可见的对象,而是视图。(我不想在这里小题大做。当你试图找到有用的答案时,会有很大的不同。)谢谢你的回答。然后,如何将iPhone的背景图像作为应用程序的背景图像?如何获取Iphone的背景图像?非常感谢,我不认为你想在非越狱设备上做的事情是可能的。