I didn't find any related question on the web, and I am trying to get a blur view to display the new blur effects .prominent and .regular but they are not showing. When I change the blur effect to .light, .extraLight or.dark, it works fine. It says in the description that the new blur effects adapts to the user interface. What does that mean, and why aren't those two new blur effects working?
I have iOS 10 in both simulator and in my iPhone and none of them are displaying the new blur effect. Print statements say that the if statement (instead of the else) is being called, as expected.
let blurEffect : UIBlurEffect!
if #available(iOS 10.0, *) {
blurEffect = UIBlurEffect(style: .prominent )
} else {
// Fallback on earlier versions
blurEffect = UIBlurEffect(style: .light )
}
let blurView = UIVisualEffectView(effect: blurEffect)
blurView.frame = CGRect(x: 100, y: 100, width: 200, height: 300)
What does that mean, and why aren't those two new blur effects working?
From WWDC 2016 Session 206: What's New in tvOS :
We've also added two new blur styles to the API.
You can now use UIBlurEffectStyleRegular or UIBlurEffectStyleProminent.
And we call these automatic styles.
And they'll actually adjust the effective blur effect style based on what the system setting is.
So if you use UIBlurEffectStyleRegular and the system's in light, it will use UIBlurEffectStyle.light.
If you use regular and dark, you'll use dark.
If you use prominent, it will use .extraLight and .extraDark.
.extraDark will be coming in a later seed
See all text of the session: http://asciiwwdc.com/2016/sessions/206
Basically this effects are for tvOS. That OS can be in dark or light style. For iOS those effects work in light mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With