Skip to content

Commit

Permalink
Merge pull request facebookarchive#461 from rogchap/fix-tableview-cel…
Browse files Browse the repository at this point in the history
…l-labels

Fix backgroundColor in tableview cell labels closes #73
  • Loading branch information
jwang committed Jul 10, 2011
2 parents 2912b80 + b3b42b2 commit 48af7a1
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Three20Style/Headers/TTDefaultStyleSheet.h
Expand Up @@ -24,6 +24,7 @@
// Common styles
@property (nonatomic, readonly) UIColor* textColor;
@property (nonatomic, readonly) UIColor* highlightedTextColor;
@property (nonatomic, readonly) UIColor* backgroundTextColor;
@property (nonatomic, readonly) UIFont* font;
@property (nonatomic, readonly) UIColor* backgroundColor;
@property (nonatomic, readonly) UIColor* navigationBarTintColor;
Expand Down
5 changes: 5 additions & 0 deletions src/Three20Style/Sources/TTDefaultStyleSheet.m
Expand Up @@ -741,6 +741,11 @@ - (UIColor*)highlightedTextColor {
return [UIColor whiteColor];
}

///////////////////////////////////////////////////////////////////////////////////////////////////
- (UIColor*)backgroundTextColor {
return [UIColor whiteColor];
}


///////////////////////////////////////////////////////////////////////////////////////////////////
- (UIFont*)font {
Expand Down
2 changes: 2 additions & 0 deletions src/Three20UI/Sources/TTTableCaptionItemCell.m
Expand Up @@ -42,6 +42,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)ident
self.textLabel.font = TTSTYLEVAR(tableTitleFont);
self.textLabel.textColor = TTSTYLEVAR(linkTextColor);
self.textLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
self.textLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);
self.textLabel.textAlignment = UITextAlignmentRight;
self.textLabel.lineBreakMode = UILineBreakModeTailTruncation;
self.textLabel.numberOfLines = 1;
Expand All @@ -50,6 +51,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)ident
self.detailTextLabel.font = TTSTYLEVAR(tableSmallFont);
self.detailTextLabel.textColor = TTSTYLEVAR(textColor);
self.detailTextLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
self.detailTextLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);
self.detailTextLabel.adjustsFontSizeToFitWidth = YES;
self.detailTextLabel.minimumFontSize = 8;
self.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
Expand Down
2 changes: 2 additions & 0 deletions src/Three20UI/Sources/TTTableMessageItemCell.m
Expand Up @@ -47,6 +47,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)ident
self.textLabel.font = TTSTYLEVAR(font);
self.textLabel.textColor = TTSTYLEVAR(textColor);
self.textLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
self.textLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);
self.textLabel.textAlignment = UITextAlignmentLeft;
self.textLabel.lineBreakMode = UILineBreakModeTailTruncation;
self.textLabel.adjustsFontSizeToFitWidth = YES;
Expand All @@ -55,6 +56,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)ident
self.detailTextLabel.font = TTSTYLEVAR(font);
self.detailTextLabel.textColor = TTSTYLEVAR(tableSubTextColor);
self.detailTextLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
self.detailTextLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);
self.detailTextLabel.textAlignment = UITextAlignmentLeft;
self.detailTextLabel.contentMode = UIViewContentModeTop;
self.detailTextLabel.lineBreakMode = UILineBreakModeTailTruncation;
Expand Down
1 change: 1 addition & 0 deletions src/Three20UI/Sources/TTTableMoreButtonCell.m
Expand Up @@ -45,6 +45,7 @@ @implementation TTTableMoreButtonCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)identifier {
if (self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier]) {
self.textLabel.font = TTSTYLEVAR(tableSmallFont);
self.textLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);
}

return self;
Expand Down
2 changes: 2 additions & 0 deletions src/Three20UI/Sources/TTTableRightCaptionItemCell.m
Expand Up @@ -37,10 +37,12 @@ @implementation TTTableRightCaptionItemCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)identifier {
if (self = [super initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:identifier]) {
self.textLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
self.textLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);
self.textLabel.lineBreakMode = UILineBreakModeWordWrap;
self.textLabel.numberOfLines = 0;

self.detailTextLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
self.detailTextLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);

// XXXjoe TODO
}
Expand Down
2 changes: 2 additions & 0 deletions src/Three20UI/Sources/TTTableSubtextItemCell.m
Expand Up @@ -38,11 +38,13 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)ident
self.detailTextLabel.font = TTSTYLEVAR(tableFont);
self.detailTextLabel.textColor = TTSTYLEVAR(textColor);
self.detailTextLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
self.detailTextLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);
self.detailTextLabel.adjustsFontSizeToFitWidth = YES;

self.textLabel.font = TTSTYLEVAR(font);
self.textLabel.textColor = TTSTYLEVAR(tableSubTextColor);
self.textLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
self.textLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);
self.textLabel.textAlignment = UITextAlignmentLeft;
self.textLabel.contentMode = UIViewContentModeTop;
self.textLabel.lineBreakMode = UILineBreakModeWordWrap;
Expand Down
2 changes: 2 additions & 0 deletions src/Three20UI/Sources/TTTableSubtitleItemCell.m
Expand Up @@ -42,13 +42,15 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)ident
self.textLabel.font = TTSTYLEVAR(tableFont);
self.textLabel.textColor = TTSTYLEVAR(textColor);
self.textLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
self.textLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);
self.textLabel.textAlignment = UITextAlignmentLeft;
self.textLabel.lineBreakMode = UILineBreakModeTailTruncation;
self.textLabel.adjustsFontSizeToFitWidth = YES;

self.detailTextLabel.font = TTSTYLEVAR(font);
self.detailTextLabel.textColor = TTSTYLEVAR(tableSubTextColor);
self.detailTextLabel.highlightedTextColor = TTSTYLEVAR(highlightedTextColor);
self.detailTextLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);
self.detailTextLabel.textAlignment = UITextAlignmentLeft;
self.detailTextLabel.contentMode = UIViewContentModeTop;
self.detailTextLabel.lineBreakMode = UILineBreakModeTailTruncation;
Expand Down
1 change: 1 addition & 0 deletions src/Three20UI/Sources/TTTableTextItemCell.m
Expand Up @@ -124,6 +124,7 @@ - (void)setObject:(id)object {

TTTableTextItem* item = object;
self.textLabel.text = item.text;
self.textLabel.backgroundColor = TTSTYLEVAR(backgroundTextColor);

if ([object isKindOfClass:[TTTableButton class]]) {
self.textLabel.font = TTSTYLEVAR(tableButtonFont);
Expand Down

0 comments on commit 48af7a1

Please sign in to comment.