I realize that I can add UIVisualEffects programmatically, conditionally executed if the class exists, eg.
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 the visual effects views in the storyboard, then conditionally remove them in order to be compatible with iOS7? I tried this but keep getting this error: Class Unavailable UIVisualEffectView prior to iOS8
Nope. you can change your deployment target to iOS 8+ to kill the error though:
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