简体   繁体   English

UIVisualEffectView在iPhone 6上不起作用

[英]UIVisualEffectView not working on iPhone 6

It appears that the UIVisualEffectView does not blur the background when run on iPhone 6/6S. 在iPhone 6 / 6S上运行时, UIVisualEffectView似乎不会模糊背景。 I have only seen one other person mention this, on the Apple Developer Forums , but nothing here. Apple Developer Forum上 ,我只看到一个人提到这一点,但这里没有。

I've written a sample project to demonstrate this. 我编写了一个示例项目来演示这一点。 All you have to do is run this on an actual iPad and an iPhone 6 and you'll see. 您所要做的就是在实际的iPad和iPhone 6上运行此操作,您将看到。 Note you'll need to add an image to your project. 请注意,您需要在项目中添加图片。

It works fine in the simulator, but the blur view is opaque when run on an actual iPhone 6 or 6S. 它在模拟器中可以正常工作,但是在实际的iPhone 6或6S上运行时,模糊视图是不透明的。

My simple view controller: 我的简单视图控制器:

class ViewController: UIViewController {

  override func viewDidLoad() {
    super.viewDidLoad()

    let effectView = UIVisualEffectView.init(effect: UIBlurEffect.init(style: .Light))
    effectView.frame = CGRectMake(20, 100, 200, 200)

    let imageView = UIImageView.init(image: UIImage(named: "image"))
    imageView.contentMode = UIViewContentMode.ScaleAspectFill
    imageView.frame = self.view.bounds

    self.view.addSubview(imageView)
    self.view.addSubview(effectView)
  }

}

I'm using Xcode 7 GM and running iOS 9.0.2 on both iPad Mini 2 and iPhone 6S. 我正在使用Xcode 7 GM,并在iPad Mini 2和iPhone 6S上都运行iOS 9.0.2。

我在iPhone的“辅助功能”设置中关闭了“降低透明度”。

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

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