diff --git a/Source/ASCellNode.h b/Source/ASCellNode.h index c09becc4f..13aaca7ad 100644 --- a/Source/ASCellNode.h +++ b/Source/ASCellNode.h @@ -211,6 +211,11 @@ typedef NS_ENUM(NSUInteger, ASCellNodeVisibilityEvent) { */ @property UIEdgeInsets separatorInset; +/* @abstract The inset of the cell background color + * ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes. + */ +@property UIColor *cellBackgroundColor; + @end @interface ASCellNode (Unavailable) diff --git a/Source/ASTableView.mm b/Source/ASTableView.mm index 195cb183c..3a11b11c9 100644 --- a/Source/ASTableView.mm +++ b/Source/ASTableView.mm @@ -107,24 +107,27 @@ - (void)setElement:(ASCollectionElement *)element ASCellNode *node = element.node; if (node) { - self.backgroundColor = node.backgroundColor; - self.selectedBackgroundView = node.selectedBackgroundView; - self.backgroundView = node.backgroundView; + if (node.cellBackgroundColor != nil) { + self.backgroundColor = node.cellBackgroundColor; + } + if (node.selectedBackgroundView != nil) { + self.selectedBackgroundView = node.selectedBackgroundView; + } #if TARGET_OS_IOS self.separatorInset = node.separatorInset; #endif - self.selectionStyle = node.selectionStyle; + self.selectionStyle = node.selectionStyle; self.focusStyle = node.focusStyle; self.accessoryType = node.accessoryType; - self.isAccessibilityElement = node.isAccessibilityElement; - self.accessibilityElementsHidden = node.accessibilityElementsHidden; + + if (node.tintColor != nil) { + self.tintColor = node.tintColor; + } + // the following ensures that we clip the entire cell to it's bounds if node.clipsToBounds is set (the default) // This is actually a workaround for a bug we are seeing in some rare cases (selected background view // overlaps other cells if size of ASCellNode has changed.) self.clipsToBounds = node.clipsToBounds; - - // If the cell node has been explicitly configured with a tint color, we can apply that directly to the cell view to preserve the previous behavior - self.tintColor = node->_tintColor; } [node __setSelectedFromUIKit:self.selected];