Commit bdc16b55 authored by Felix Paul Kühne's avatar Felix Paul Kühne

frosted glass view: use toolbar hack only if we can't use UIVisualEffectView

aka on iOS 7

(cherry picked from commit ed3cbef8d54f2f44ff09acf637d1b2ac8e8542a2)
parent 43cd786a
......@@ -14,13 +14,15 @@
#import "VLCFrostedGlasView.h"
@interface VLCFrostedGlasView ()
{
BOOL _usingToolbarHack;
}
#if TARGET_OS_IOS
@property (nonatomic) UIToolbar *toolbar;
@property (nonatomic) UIImageView *imageview;
#else
@property (nonatomic) UIVisualEffectView *effectView;
#endif
@property (nonatomic) UIVisualEffectView *effectView;
@end
......@@ -50,10 +52,19 @@
[self setClipsToBounds:YES];
#if TARGET_OS_IOS
if (![self toolbar]) {
[self setToolbar:[[UIToolbar alloc] initWithFrame:[self bounds]]];
[self.layer insertSublayer:[self.toolbar layer] atIndex:0];
[self.toolbar setBarStyle:UIBarStyleBlack];
if ([UIVisualEffectView class] != nil) {
_effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
_effectView.frame = self.bounds;
_effectView.clipsToBounds = YES;
_effectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self insertSubview:_effectView atIndex:0];
} else {
_usingToolbarHack = YES;
if (![self toolbar]) {
[self setToolbar:[[UIToolbar alloc] initWithFrame:[self bounds]]];
[self.layer insertSublayer:[self.toolbar layer] atIndex:0];
[self.toolbar setBarStyle:UIBarStyleBlack];
}
}
#else
_effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
......@@ -67,7 +78,9 @@
#if TARGET_OS_IOS
- (void)layoutSubviews {
[super layoutSubviews];
[self.toolbar setFrame:[self bounds]];
if (_usingToolbarHack) {
[self.toolbar setFrame:[self bounds]];
}
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment