Skip to content

Commit

Permalink
Merge pull request #8491 from hansemannn/TIMOB-24007
Browse files Browse the repository at this point in the history
[TIMOB-24007] iOS: Expose selectedColor in Ti.UI.ListItem
  • Loading branch information
cheekiatng committed Oct 10, 2016
2 parents a2e370e + 5076cf9 commit 574902d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
13 changes: 9 additions & 4 deletions apidoc/Titanium/UI/ListItem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,15 @@ properties:
Only applies to the built-in templates.
type: String
accessors: false


- name: selectedColor
summary: Color to use for the item title when the item is selected, as a color name or hex triplet.
description: |
For information about color values, see the "Colors" section of <Titanium.UI>.
type: String
since: "6.0.0"
platforms: [iphone,ipad]

- name: font
summary: Font to use for the item title.
description: |
Expand Down Expand Up @@ -622,6 +630,3 @@ properties:
By default the background color of the row action is defined by the style applied. Use this property to
override the default background color of the row action.
optional: true



10 changes: 10 additions & 0 deletions iphone/Classes/TiUIListItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,16 @@ - (void)setDataItem:(NSDictionary *)dataItem
}
}
}

id selectedColor = [properties objectForKey:@"selectedColor"];
if ([self shouldUpdateValue:selectedColor forKeyPath:@"textLabel.highlightedTextColor"]) {
UIColor *color = selectedColor != nil ? [[TiUtils colorValue:selectedColor] _color] : nil;
if (color != nil) {
[self recordChangeValue:selectedColor forKeyPath:@"textLabel.highlightedTextColor" withBlock:^{
[self.textLabel setHighlightedTextColor:color];
}];
}
}

id fontValue = [properties objectForKey:@"font"];
if ([self shouldUpdateValue:fontValue forKeyPath:@"textLabel.font"]) {
Expand Down

0 comments on commit 574902d

Please sign in to comment.