Fix issues #2009
[bug] ASCellNode has no background color in iOS 13
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
CainLuo seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.
Regarding the above issue, I found the specific problem, in the - (void)setElement:(ASCollectionElement *)element method of the ASTableView.mm file, the backgroundColor of node is used to set the _ ASTableViewCell's backgroundColor, I think this is incorrect, because node's backgroundColor should not be used to set as _ASTableViewCell's backgroundColor, but to open a separate property value of color to set separately. The temporary solution is to comment out self.backgroundColor = node.backgroundColor; and hope that it can be solved in subsequent versions of Texture. #2010
Before: No cellBackgroundColor property
After
ASCellNode.h add cellBackgroundColor
/* @abstract The inset of the cell background color
* ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes.
*/
@property UIColor *cellBackgroundColor;
ASTableNode.mm update setElement method:
- (void)setElement:(ASCollectionElement *)element
{
_element = element;
ASCellNode *node = element.node;
if (node) {
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.focusStyle = node.focusStyle;
self.accessoryType = node.accessoryType;
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;
}
[node __setSelectedFromUIKit:self.selected];
[node __setHighlightedFromUIKit:self.highlighted];
}
@Adlai-Holler Hello, I fixed a problem, but I can't seem to merge it, how can I fix it?