UITableView: selected cell color is not rendered in ios13

Har*_*ddy 4 ios13

I'm using Xcode 11 beta 6, on selecting the UITableViewcell ,cell has not been highlighted.It has a white background instead of showing selected background color.

nam*_*tee 8

每个iOS 13发行说明(https://developer.apple.com/documentation/ios_ipados_release_notes/ios_ipados_13_beta_8_release_notes)-当单元格突出显示或选中时,UITableViewCell类不再更改contentView及其子视图的backgroundColor或isOpaque属性。

当单元格变为突出显示或选中状态时,UITableViewCell类不再更改contentView及其任何子视图的backgroundColor或isOpaque属性。如果要在contentView内部(包括其中)的单元格的任何子视图上设置不透明的backgroundColor,则该单元格突出显示或选中时的外观可能会受到影响。解决子视图问题的最简单方法是确保将其backgroundColor设置为nil或clear,并且其opaque属性为false。但是,如果需要,您可以覆盖setHighlighted(:animated :)和setSelected(:animated :)方法,以在移入或移出突出显示和选定状态时手动更改子视图上的这些属性。

  • 有关13.1.2。很高兴知道为什么会发生这种变化。可以肯定,像我这样的开发人员会在短时间内感到沮丧,弄清楚他们选择的颜色发生了什么 (7认同)