I present the View Controller modally with a background blur effect. IOS 10 / Xcode 8 has a problem with my animation. This is the presentation code:
let modalVC = ModalViewController(nibName: "ModalViewController", bundle: nil) modalVC.modalTransitionStyle = .CrossDissolve modalVC.modalPresentationStyle = .OverFullScreen presentViewController(modalVC, animated: true, completion: nil)
Adding blur to the viewDidLoad() function in ModalViewController:
let blurEffect = UIBlurEffect(style: .Light) let blurEffectView = UIVisualEffectView(effect: blurEffect) blurEffectView.frame = view.bounds blurEffectView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] view.addSubview(blurEffectView) view.sendSubviewToBack(blurEffectView)
ModalViewController has a clean background, and I added a BlurEffectView with a blur effect. I tried programmatically with the previous snippet and in Interface Builder.
In iOS 8 and 9, the .CrossDissolve transition .CrossDissolve care of βattenuation,β but after testing on iOS 10 (both on the device and on the simulator), the view appears with a dark translucent background color instead of blurring.
After the .CrossDissolve animation .CrossDissolve , the background color changes to the actual background of the blur effect. Any ideas why this is happening?
Also tried adding layoutIfNeeded() to the beginning and end of viewDidLoad() for the modal controller. I am using swift 2.3
source share