UIVisualEffectView not working on iPhone 6

别等时光非礼了梦想. 提交于 2019-12-12 10:46:32

问题


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.

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.

It works fine in the simulator, but the blur view is opaque when run on an actual iPhone 6 or 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.


回答1:


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



来源:https://stackoverflow.com/questions/32877674/uivisualeffectview-not-working-on-iphone-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!