VLCNetworkLoginViewButtonCell.m 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. NSString * const kVLCNetworkLoginViewButtonCellIdentifier = @"VLCNetworkLoginViewButtonCellIdentifier";
  13. @interface VLCNetworkLoginViewButtonCell ()
  14. @property (nonatomic) UIView *blackView;
  15. @end
  16. @implementation VLCNetworkLoginViewButtonCell
  17. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  18. {
  19. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  20. if (self) {
  21. self.backgroundColor = [UIColor VLCDarkBackgroundColor];
  22. self.textLabel.backgroundColor = [UIColor clearColor];
  23. self.textLabel.textColor = [UIColor whiteColor];
  24. self.textLabel.textAlignment = NSTextAlignmentCenter;
  25. self.accessibilityTraits = UIAccessibilityTraitButton;
  26. UIView *blackView = [[UIView alloc] init];
  27. [self insertSubview:blackView atIndex:0];
  28. blackView.backgroundColor = [UIColor blackColor];
  29. self.blackView = blackView;
  30. }
  31. return self;
  32. }
  33. - (void)layoutSubviews
  34. {
  35. [super layoutSubviews];
  36. self.blackView.frame = CGRectInset(self.bounds, 0.0, 2.0);
  37. }
  38. - (void)prepareForReuse
  39. {
  40. [super prepareForReuse];
  41. self.titleString = nil;
  42. }
  43. - (void)setTitleString:(NSString *)title
  44. {
  45. self.textLabel.text = title;
  46. self.accessibilityValue = title;
  47. }
  48. - (NSString *)titleString
  49. {
  50. return self.textLabel.text;
  51. }
  52. @end