UIVisualEffectView无法在iPhone 6上运行 [英] UIVisualEffectView not working on iPhone 6

查看:115
本文介绍了UIVisualEffectView无法在iPhone 6上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iPhone 6 / 6S上运行时, UIVisualEffectView 似乎不会模糊背景。我在 Apple开发者论坛中只看到另一个人提到这个,但这里没有任何内容。

It appears that the UIVisualEffectView does not blur the background when run on iPhone 6/6S. I have only seen one other person mention this, on the Apple Developer Forums, but nothing here.

我写了一个示例项目来证明这一点。所有你需要做的就是在真正的iPad和iPhone 6上运行它,你会看到。请注意,您需要在项目中添加图像。

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. Note you'll need to add an image to your project.

它在模拟器中工作正常,但在实际的iPhone 6或6S上运行时模糊视图不透明。

It works fine in the simulator, but the blur view is opaque when run on an actual iPhone 6 or 6S.

我的简单视图控制器:

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)
  }

}

我正在使用Xcode 7 GM并在iPad Mini 2和iPhone 6S上运行iOS 9.0.2。

I'm using Xcode 7 GM and running iOS 9.0.2 on both iPad Mini 2 and iPhone 6S.

推荐答案

我已关闭减少透明度在我的iPhone的辅助功能设置中。

I had Reduce Transparency turned off in the Accessibility settings of my iPhone.

这篇关于UIVisualEffectView无法在iPhone 6上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆