|
|
@@ -38,25 +38,37 @@
|
|
|
self.textLabel.font = [UIFont fontWithName:@"HelveticaNeue-Medium" size:14.0];
|
|
|
self.detailTextLabel.font = [FLEXUtility defaultTableViewCellLabelFont];
|
|
|
self.accessoryType = UITableViewCellAccessoryDetailButton;
|
|
|
+
|
|
|
+ self.viewBackgroundColorView = [[UIView alloc] init];
|
|
|
+ self.viewBackgroundColorView.clipsToBounds = YES;
|
|
|
+ self.viewBackgroundColorView.layer.borderColor = [UIColor blackColor].CGColor;
|
|
|
+ self.viewBackgroundColorView.layer.borderWidth = 1.0f;
|
|
|
+ [self.contentView addSubview:self.viewBackgroundColorView];
|
|
|
}
|
|
|
return self;
|
|
|
}
|
|
|
|
|
|
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
|
|
|
{
|
|
|
+ UIColor *originalColour = self.viewBackgroundColorView.backgroundColor;
|
|
|
[super setHighlighted:highlighted animated:animated];
|
|
|
|
|
|
// UITableViewCell changes all subviews in the contentView to backgroundColor = clearColor.
|
|
|
// We want to preserve the hierarchy background color when highlighted.
|
|
|
self.depthIndicatorView.backgroundColor = [FLEXUtility hierarchyIndentPatternColor];
|
|
|
+
|
|
|
+ self.viewBackgroundColorView.backgroundColor = originalColour;
|
|
|
}
|
|
|
|
|
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
|
|
|
{
|
|
|
+ UIColor *originalColour = self.viewBackgroundColorView.backgroundColor;
|
|
|
[super setSelected:selected animated:animated];
|
|
|
|
|
|
// See setHighlighted above.
|
|
|
self.depthIndicatorView.backgroundColor = [FLEXUtility hierarchyIndentPatternColor];
|
|
|
+
|
|
|
+ self.viewBackgroundColorView.backgroundColor = originalColour;
|
|
|
}
|
|
|
|
|
|
- (void)layoutSubviews
|
|
|
@@ -65,6 +77,7 @@
|
|
|
|
|
|
const CGFloat kContentPadding = 10.0;
|
|
|
const CGFloat kDepthIndicatorWidthMultiplier = 4.0;
|
|
|
+ const CGFloat kViewBackgroundColourDimension = 20;
|
|
|
|
|
|
CGRect depthIndicatorFrame = CGRectMake(kContentPadding, 0, self.viewDepth * kDepthIndicatorWidthMultiplier, self.contentView.bounds.size.height);
|
|
|
self.depthIndicatorView.frame = depthIndicatorFrame;
|
|
|
@@ -77,7 +90,7 @@
|
|
|
CGRect textLabelFrame = self.textLabel.frame;
|
|
|
CGFloat textOriginX = CGRectGetMaxX(circleFrame) + 4.0;
|
|
|
textLabelFrame.origin.x = textOriginX;
|
|
|
- textLabelFrame.size.width = CGRectGetMaxX(self.contentView.bounds) - kContentPadding - textOriginX;
|
|
|
+ textLabelFrame.size.width = CGRectGetMaxX(self.contentView.frame) - kContentPadding - textOriginX - kViewBackgroundColourDimension;
|
|
|
self.textLabel.frame = textLabelFrame;
|
|
|
|
|
|
CGRect detailTextLabelFrame = self.detailTextLabel.frame;
|
|
|
@@ -85,6 +98,15 @@
|
|
|
detailTextLabelFrame.origin.x = detailOriginX;
|
|
|
detailTextLabelFrame.size.width = CGRectGetMaxX(self.contentView.bounds) - kContentPadding - detailOriginX;
|
|
|
self.detailTextLabel.frame = detailTextLabelFrame;
|
|
|
+
|
|
|
+ CGRect viewBackgroundColourViewFrame = self.textLabel.frame;
|
|
|
+ viewBackgroundColourViewFrame.size.width = kViewBackgroundColourDimension;
|
|
|
+ viewBackgroundColourViewFrame.size.height = kViewBackgroundColourDimension;
|
|
|
+ viewBackgroundColourViewFrame.origin.x = CGRectGetMaxX(self.textLabel.frame) + kContentPadding;
|
|
|
+ viewBackgroundColourViewFrame.origin.y = ABS(CGRectGetHeight(self.contentView.frame) - CGRectGetHeight(viewBackgroundColourViewFrame)) / 2;
|
|
|
+
|
|
|
+ self.viewBackgroundColorView.frame = viewBackgroundColourViewFrame;
|
|
|
+ self.viewBackgroundColorView.layer.cornerRadius = kViewBackgroundColourDimension / 2;
|
|
|
}
|
|
|
|
|
|
- (void)setViewColor:(UIColor *)viewColor
|