VLCNetworkLoginViewButtonCell.m 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*****************************************************************************
  2. * VLC for iOS
  3. *****************************************************************************
  4. * Copyright (c) 2016 VideoLAN. All rights reserved.
  5. * $Id$
  6. *
  7. * Authors: Vincent L. Cone <vincent.l.cone # tuta.io>
  8. *
  9. * Refer to the COPYING file of the official project for license.
  10. *****************************************************************************/
  11. #import "VLCNetworkLoginViewButtonCell.h"
  12. #import "VLC-Swift.h"
  13. NSString * const kVLCNetworkLoginViewButtonCellIdentifier = @"VLCNetworkLoginViewButtonCellIdentifier";
  14. @interface VLCNetworkLoginViewButtonCell ()
  15. @property (nonatomic) UIView *blackView;
  16. @end
  17. @implementation VLCNetworkLoginViewButtonCell
  18. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  19. {
  20. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  21. if (self) {
  22. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(themeDidChange) name:kVLCThemeDidChangeNotification object:nil];
  23. [self themeDidChange];
  24. self.textLabel.backgroundColor = UIColor.clearColor;
  25. self.textLabel.textColor = UIColor.whiteColor;
  26. self.textLabel.textAlignment = NSTextAlignmentCenter;
  27. self.accessibilityTraits = UIAccessibilityTraitButton;
  28. UIView *blackView = [[UIView alloc] init];
  29. [self insertSubview:blackView atIndex:0];
  30. blackView.backgroundColor = PresentationTheme.current.colors.orangeUI;
  31. self.blackView = blackView;
  32. }
  33. return self;
  34. }
  35. - (void)layoutSubviews
  36. {
  37. [super layoutSubviews];
  38. self.blackView.frame = CGRectInset(self.bounds, 0.0, 2.0);
  39. }
  40. - (void)prepareForReuse
  41. {
  42. [super prepareForReuse];
  43. self.titleString = nil;
  44. }
  45. - (void)setTitleString:(NSString *)title
  46. {
  47. self.textLabel.text = title;
  48. self.accessibilityValue = title;
  49. }
  50. - (NSString *)titleString
  51. {
  52. return self.textLabel.text;
  53. }
  54. - (void)themeDidChange
  55. {
  56. self.backgroundColor = PresentationTheme.current.colors.background;
  57. }
  58. @end