Open CainLuo opened 3 years ago
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.
It is actually a new behavior introduced since iOS 14 UIKit. When cell.backgroundColor
is not set, it puts _UISystemBackgroundView
to make your backgroundColor white, rather than transparent as before. Not really related to Texture here.
In this case, I suggest just specifying cellNode.backgroundColor
to whatever you'd like.
It's not, it's also normal in iOS 12, only iOS 13 has problems, you can download an iOS 13 emulator to check it. @denkeni
Would you mind providing a sample project to replicate the issue? I’ve created a sample project based on my understanding of this issue, which happens on iOS 14 or later:
最近也发现了这个问题,TableViewCell背景颜色默认是白色,无论我怎么设置Node的颜色,结果都一样是白色。解决问题的过程中也试过改源码,虽然能解决问题,但是如果改源码,每次pod install 后都要重新修改。最后通过下面的代码解决。
func tableNode(_ tableNode: ASTableNode, willDisplayRowWith node: ASCellNode) {
/** 遍历superView,找到UITableViewCell,设置背景色为clear。
解决iOS 14后系统默认 UITableViewCell 背景为白色的问题 */
var view: UIView = node.view // 假设这是你要开始遍历的视图
while let superview = view.superview {
view = superview
if let tmp = view.superview, let cell = tmp as? UITableViewCell {
cell.backgroundColor = .clear
break
} else {
break
}
}
}
ASCellNode has no background color in iOS 13 version, but it is normal in iOS 12 or iOS 14, how can I fix it? @garrettmoon
iOS 13
iOS 14