VLCFrostedGlasView.m 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*****************************************************************************
  2. * VLCFrostedGlasView.m
  3. * VLC for iOS
  4. *****************************************************************************
  5. * Copyright (c) 2013 VideoLAN. All rights reserved.
  6. * $Id$
  7. *
  8. * Authors: Carola Nitz <nitz.carola # googlemail.com>
  9. *
  10. * Refer to the COPYING file of the official project for license.
  11. *****************************************************************************/
  12. #import "VLCFrostedGlasView.h"
  13. @interface VLCFrostedGlasView ()
  14. @property (nonatomic) UIToolbar *toolbar;
  15. @property (nonatomic) UIImageView *imageview;
  16. @end
  17. @implementation VLCFrostedGlasView
  18. - (id)initWithCoder:(NSCoder *)aDecoder
  19. {
  20. self = [super initWithCoder:aDecoder];
  21. if (self) {
  22. [self setClipsToBounds:YES];
  23. if (SYSTEM_RUNS_IOS7_OR_LATER) {
  24. if (![self toolbar]) {
  25. [self setToolbar:[[UIToolbar alloc] initWithFrame:[self bounds]]];
  26. [self.layer insertSublayer:[self.toolbar layer] atIndex:0];
  27. [self.toolbar setBarStyle:UIBarStyleBlack];
  28. }
  29. } else {
  30. if(![self imageview]) {
  31. [self setImageview:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"playbackControllerBg"]]];
  32. [self insertSubview:self.imageview atIndex:0];
  33. }
  34. }
  35. }
  36. return self;
  37. }
  38. - (void)layoutSubviews {
  39. [super layoutSubviews];
  40. if (SYSTEM_RUNS_IOS7_OR_LATER) {
  41. [self.toolbar setFrame:[self bounds]];
  42. } else {
  43. [self.imageview setFrame:[self bounds]];
  44. }
  45. }
  46. @end