Skip to content

Commit

Permalink
[TIMOB-15193] Set up cell background after it is attached
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalduggal committed Sep 17, 2013
1 parent a4bff33 commit 96fa12c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions iphone/Classes/TiUIListItem.h
Expand Up @@ -31,6 +31,7 @@ enum {

- (BOOL)canApplyDataItem:(NSDictionary *)otherItem;
- (void)setPosition:(int)position isGrouped:(BOOL)grouped;
- (void)configureCellBackground;
@end

#endif
17 changes: 17 additions & 0 deletions iphone/Classes/TiUIListItem.m
Expand Up @@ -321,6 +321,23 @@ - (BOOL)canApplyDataItem:(NSDictionary *)otherItem;
return same;
}

- (void)configureCellBackground
{
//Ensure that we store the default backgroundColor
if ([_initialValues objectForKey:@"backgroundColor"] == nil) {
id initialValue = [self backgroundColor];
[_initialValues setObject:(initialValue != nil ? initialValue : [NSNull null]) forKey:@"backgroundColor"];
}
id propertiesValue = [_dataItem objectForKey:@"properties"];
NSDictionary *properties = ([propertiesValue isKindOfClass:[NSDictionary class]]) ? propertiesValue : nil;
id colorValue = [properties objectForKey:@"backgroundColor"];
UIColor *color = colorValue != nil ? [[TiUtils colorValue:colorValue] _color] : nil;
if (color == nil) {
color = [_initialValues objectForKey:@"backgroundColor"];
}
self.backgroundColor = color;
}

- (void)setDataItem:(NSDictionary *)dataItem
{
_dataItem = [dataItem retain];
Expand Down

0 comments on commit 96fa12c

Please sign in to comment.