Class not available UIVisualEffectView prior to iOS8

I understand that I can add UIVisualEffects programmatically, conditionally executed if the class exists, for example.

if([UIVisualEffectView class]){ UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; [blurEffectView setFrame:self.backgroundBlurView.bounds]; [self.backgroundBlurView addSubview:blurEffectView]; UIVibrancyEffect *vibrancyEffect = [UIVibrancyEffect effectForBlurEffect:blurEffect]; UIVisualEffectView *vibrancyEffectView = [[UIVisualEffectView alloc] initWithEffect:vibrancyEffect]; [vibrancyEffectView setFrame:self.backgroundVibrancyView.bounds]; [[vibrancyEffectView contentView] addSubview:self.backgroundVibrancyView]; [[blurEffectView contentView] addSubview:vibrancyEffectView]; vibrancyEffectView.center = blurEffectView.center; } 

But is there a way to add visual effects to the storyboard, then conditionally delete them to be compatible with iOS7? I tried this but keep getting this error: Class is not available UIVisualEffectView prior to iOS8

+5
source share
1 answer

Nope. you can change the deployment target on iOS 8+ to kill the error:

+1
source

Source: https://habr.com/ru/post/1204870/


All Articles