VLCSidebarViewCell.m 2.8 KB

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