From a603f51563889b0532e10592dcc087df4ef9e8e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= Date: Sat, 10 Aug 2013 20:16:49 +0200 Subject: [PATCH] menu cell: customization for VLC --- Demo/GHMenuCell.h | 2 ++ Demo/GHMenuCell.m | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Demo/GHMenuCell.h b/Demo/GHMenuCell.h index dab09c8..e4c1df7 100644 --- a/Demo/GHMenuCell.h +++ b/Demo/GHMenuCell.h @@ -12,4 +12,6 @@ extern NSString const *kSidebarCellImageKey; @interface GHMenuCell : UITableViewCell +@property (nonatomic, strong) UIImageView *titleImageView; + @end diff --git a/Demo/GHMenuCell.m b/Demo/GHMenuCell.m index 1559b86..1a5d20e 100644 --- a/Demo/GHMenuCell.m +++ b/Demo/GHMenuCell.m @@ -21,27 +21,30 @@ NSString const *kSidebarCellImageKey = @"CellImage"; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) { self.clipsToBounds = YES; - + UIView *bgView = [[UIView alloc] init]; bgView.backgroundColor = [UIColor colorWithRed:(38.0f/255.0f) green:(44.0f/255.0f) blue:(58.0f/255.0f) alpha:1.0f]; self.selectedBackgroundView = bgView; - + self.imageView.contentMode = UIViewContentModeCenter; - + self.titleImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 260.0f, 50.0f)]; + self.titleImageView.contentMode = UIViewContentModeCenter; + [self.textLabel.superview addSubview:self.titleImageView]; + self.textLabel.font = [UIFont fontWithName:@"Helvetica" size:([UIFont systemFontSize] * 1.2f)]; self.textLabel.shadowOffset = CGSizeMake(0.0f, 1.0f); self.textLabel.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.25f]; self.textLabel.textColor = [UIColor colorWithRed:(196.0f/255.0f) green:(204.0f/255.0f) blue:(218.0f/255.0f) alpha:1.0f]; - + UIView *topLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)]; topLine.backgroundColor = [UIColor colorWithRed:(54.0f/255.0f) green:(61.0f/255.0f) blue:(76.0f/255.0f) alpha:1.0f]; [self.textLabel.superview addSubview:topLine]; - + UIView *topLine2 = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 1.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)]; topLine2.backgroundColor = [UIColor colorWithRed:(54.0f/255.0f) green:(61.0f/255.0f) blue:(77.0f/255.0f) alpha:1.0f]; [self.textLabel.superview addSubview:topLine2]; - - UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 43.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)]; + + UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 50.0f, [UIScreen mainScreen].bounds.size.height, 1.0f)]; bottomLine.backgroundColor = [UIColor colorWithRed:(40.0f/255.0f) green:(47.0f/255.0f) blue:(61.0f/255.0f) alpha:1.0f]; [self.textLabel.superview addSubview:bottomLine]; } @@ -51,8 +54,9 @@ NSString const *kSidebarCellImageKey = @"CellImage"; #pragma mark UIView - (void)layoutSubviews { [super layoutSubviews]; - self.textLabel.frame = CGRectMake(50.0f, 0.0f, 200.0f, 43.0f); - self.imageView.frame = CGRectMake(0.0f, 0.0f, 50.0f, 43.0f); + self.textLabel.frame = CGRectMake(50.0f, 0.0f, 200.0f, 50.0f); + self.titleImageView.frame = CGRectMake(0.0f, 0.0f, 260.0f, 50.0f); + self.imageView.frame = CGRectMake(0.0f, 0.0f, 50.0f, 50.0f); } @end -- 1.8.3.1 (Apple Git-46)