UITableView: selected cell has white background

When building an app using Xcode 10 and running it on iOS 13.0 beta 3, standard table view cells have a white background color that is almost indistinguishable from the table view background. When building the same app using Xcode 11 beta (or when deploying it to an iOS 12 device), the selection style has a gray background as usual.


Did I do anything wrong here? Or is this a bug in iOS which I suspect? (Filed as FB6424669)

Replies

Hey - did you hear anything back about the bug you filed? I'm also encountering the same issue. I imagine it's related to the following:


The UITableViewCell class no longer changes the backgroundColor or isOpaque properties of the contentView and any of its subviews when cells become highlighted or selected. If you are setting an opaque backgroundColor on any subviews of the cell inside (and including) the contentView, the appearance when the cell becomes highlighted or selected might be affected. The simplest way to resolve any issues with your subviews is to ensure their backgroundColor is set to nil or clear, and their opaque property is false. However, if needed you can override the setHighlighted(:animated:) and setSelected(:animated:) methods to manually change these properties on your subviews when moving to or from the highlighted and selected states. (13955336)


But it would be good to get confirmation if this is just a bug in betas...

The selected / highlighted background colour seems fairly inconsistent throughout the whole OS in the latest beta.

No, I haven't heard anything back.


Since the problem only occurs in legacy mode (when building against the iOS 12 SDK using Xcode 10) and happens in dozens of apps from the App Store, imo that's clearly a bug.


Also, setting the backgroundColor to clear and opaque to false doesn't help.

This is been resolved in Beta5 which just been released today