VLCSidebarViewCell.m 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // VLCSidebarViewCell.m
  3. // VLC for iOS
  4. //
  5. // Created by Felix Paul Kühne on 30.09.13.
  6. // Copyright (c) 2013 VideoLAN. All rights reserved.
  7. //
  8. // Refer to the COPYING file of the official project for license.
  9. //
  10. #import "VLCSidebarViewCell.h"
  11. @implementation VLCSidebarViewCell
  12. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  13. if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
  14. self.clipsToBounds = YES;
  15. self.backgroundColor = [UIColor colorWithRed:(43.0f/255.0f) green:(43.0f/255.0f) blue:(43.0f/255.0f) alpha:1.0f];
  16. UIView *bgView = [[UIView alloc] init];
  17. bgView.backgroundColor = [UIColor colorWithRed:0.1137 green:0.1137 blue:0.1137 alpha:1.0f];
  18. self.selectedBackgroundView = bgView;
  19. self.imageView.contentMode = UIViewContentModeCenter;
  20. self.titleImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 260.0f, 50.0f)];
  21. self.titleImageView.contentMode = UIViewContentModeCenter;
  22. [self.textLabel.superview addSubview:self.titleImageView];
  23. self.textLabel.font = [UIFont fontWithName:@"Helvetica" size:([UIFont systemFontSize] * 1.2f)];
  24. self.textLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
  25. self.textLabel.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.25f];
  26. self.textLabel.textColor = [UIColor whiteColor];
  27. self.textLabel.adjustsFontSizeToFitWidth = YES;
  28. if ([self.textLabel respondsToSelector:@selector(setAdjustsLetterSpacingToFitWidth:)])
  29. self.textLabel.adjustsLetterSpacingToFitWidth = YES;
  30. self.textLabel.minimumScaleFactor = 0.5f;
  31. self.textLabel.lineBreakMode = NSLineBreakByTruncatingTail;
  32. UIView *topLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
  33. topLine.backgroundColor = [UIColor colorWithRed:(16.0f/255.0f) green:(16.0f/255.0f) blue:(16.0f/255.0f) alpha:1.0f];
  34. [self.textLabel.superview addSubview:topLine];
  35. UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 50.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)];
  36. bottomLine.backgroundColor = [UIColor colorWithRed:(23.0f/255.0f) green:(23.0f/255.0f) blue:(23.0f/255.0f) alpha:1.0f];
  37. [self.textLabel.superview addSubview:bottomLine];
  38. }
  39. return self;
  40. }
  41. - (void)layoutSubviews {
  42. [super layoutSubviews];
  43. self.textLabel.frame = CGRectMake(50.0f, 0.0f, 200.0f, 50.0f);
  44. self.titleImageView.frame = CGRectMake(0.0f, 0.0f, 260.0f, 50.0f);
  45. self.imageView.frame = CGRectMake(0.0f, 0.0f, 50.0f, 50.0f);
  46. }
  47. @end