Reputation: 515
Currently working on someone else's existing project for a client, however having this weird issue on iOS14 devices only where every screen that had a blurred background is not appearing blurred anymore but just like a transparent grey overlay image with a low alpha value. Ive tried various things and looked online but still cant find the issue here.
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
animatedCircleView.alpha = 1
imvLogo.isHidden = false
// Hero
imvLogo.hero.id = "logo"
imvLogo.hero.modifiers = [.duration(self.animatedDuration)]
let blurEffect = (NSClassFromString("_UICustomBlurEffect") as! UIBlurEffect.Type).init()
blurEffect.setValue(8, forKeyPath: "blurRadius")
blurView = UIVisualEffectView(effect: blurEffect)
blurView.frame = UIScreen.main.bounds
blurView.alpha = 1
view.insertSubview(blurView, aboveSubview: imvBackground)
}
Here is what the blurred background look like before on iOS13:
and here is what it now looks like on iOS14:
I also tried changing the code to this, but it just gives me a solid background color instead of a blurred background:
let blurEffect = UIBlurEffect(style: .light)
blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = UIScreen.main.bounds
blurEffectView.alpha = 0
view.insertSubview(blurEffectView, aboveSubview: viewUnder)
Here is the solid background color its giving me instead:
If anyone could tell me what might be wrong or whats broken this in iOS14 that would be great and how i could go about fixing this. Thanks.
UPDATE:
I checked the view hierarchy and on ios13 the UIVisualEffectBackdropView is created correctly (see image):
But the ios14 UIVisualEffectBackdropView is created incorrectly and is just taking the background image and applying a tint to it but no blur:
Upvotes: 1
Views: 1361
Reputation: 21
@GameDev
Actually, this code uses the private API _UICustomBlurEffect that no longer works since iOS 14. You have to fall back on a regular UIBlurEffect subclass but you won't be able to set the blurRadius...
Upvotes: 2