I created a sample project for this bug. UIKit and Texture behaviors can be compared side by side.
When setting backgroundColor of ASCellNode, Texture has been setting backgroundColor on both _ASDisplayView (added on top of contentView) and underlying _ASTableViewCell.
This bug happens on iOS 13 or later, which may result from UIKit behavior change.
Prior to iOS 13, UIKit would make _ASDisplayView transparent when cell is selected. This behavior no longer works on iOS 13 or later, which results in opaque _ASDisplayView blocking selection color below (UITableViewCellSelectedBackground).
Discussion for Possible Solutions
In some example projects, [self updateBackgroundColor] was used in setSelected: of ASCellNode. If this is the suggested way going forward, it should be better documented.
We may have a workaround by assigning cellNode.backgroundColor in nodeBlockForRowAt, and then setting cellNode.backgroundColor = nil in willDisplayRowWith. Not a good solution.
In Texture, we may set node.backgroundColor = nil right after self.backgroundColor = node.backgroundColor; (backgroundColor has been passed to underlying _ASTableViewCell). However, this may only work when node.background is set inside ASCellNodeBlock.
In Texture, we may create another UITableViewCell specific passthrough property "backgroundColor" on ASCellNode, so backgroundColor would not go up to superclass ASDisplayNode and thus _ASDisplayView. However, ASCellNode does not pass backgroundColor to underlying _ASCollectionViewCell for other reasons, which will cause other issues.
Problem Statement
I created a sample project for this bug. UIKit and Texture behaviors can be compared side by side.
When setting
backgroundColor
ofASCellNode
, Texture has been settingbackgroundColor
on both_ASDisplayView
(added on top ofcontentView
) and underlying_ASTableViewCell
.This bug happens on iOS 13 or later, which may result from UIKit behavior change.
Prior to iOS 13, UIKit would make
_ASDisplayView
transparent when cell is selected. This behavior no longer works on iOS 13 or later, which results in opaque_ASDisplayView
blocking selection color below (UITableViewCellSelectedBackground
).Discussion for Possible Solutions
In some example projects,
[self updateBackgroundColor]
was used insetSelected:
ofASCellNode
. If this is the suggested way going forward, it should be better documented.We may have a workaround by assigning
cellNode.backgroundColor
innodeBlockForRowAt
, and then settingcellNode.backgroundColor = nil
inwillDisplayRowWith
. Not a good solution.In Texture, we may set
node.backgroundColor = nil
right afterself.backgroundColor = node.backgroundColor;
(backgroundColor
has been passed to underlying_ASTableViewCell
). However, this may only work whennode.background
is set insideASCellNodeBlock
.In Texture, we may create another UITableViewCell specific passthrough property "
backgroundColor
" onASCellNode
, sobackgroundColor
would not go up to superclassASDisplayNode
and thus_ASDisplayView
. However,ASCellNode
does not passbackgroundColor
to underlying_ASCollectionViewCell
for other reasons, which will cause other issues.Any other ideas?