Преглед изворни кода

frosted glass view: add reimplementation for ATV

Felix Paul Kühne пре 9 година
родитељ
комит
fcc41892fc
1 измењених фајлова са 16 додато и 2 уклоњено
  1. 16 2
      Sources/VLCFrostedGlasView.m

+ 16 - 2
Sources/VLCFrostedGlasView.m

@@ -2,10 +2,11 @@
  * VLCFrostedGlasView.m
  * VLC for iOS
  *****************************************************************************
- * Copyright (c) 2013-2014 VideoLAN. All rights reserved.
+ * Copyright (c) 2013-2015 VideoLAN. All rights reserved.
  * $Id$
  *
  * Authors: Carola Nitz <nitz.carola # googlemail.com>
+ *          Felix Paul Kühne <fkuehne # videolan # org>
  *
  * Refer to the COPYING file of the official project for license.
  *****************************************************************************/
@@ -14,8 +15,12 @@
 
 @interface VLCFrostedGlasView ()
 
+#if TARGET_OS_IOS
 @property (nonatomic) UIToolbar *toolbar;
 @property (nonatomic) UIImageView *imageview;
+#else
+@property (nonatomic)  UIVisualEffectView *effectView;
+#endif
 
 @end
 
@@ -44,16 +49,25 @@
 {
     [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];
     }
+#else
+    _effectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
+    _effectView.frame = self.bounds;
+    _effectView.clipsToBounds = YES;
+    [self addSubview:_effectView];
+#endif
 }
 
+#if TARGET_OS_IOS
 - (void)layoutSubviews {
     [super layoutSubviews];
     [self.toolbar setFrame:[self bounds]];
 }
+#endif
 
-@end
+@end