This issue appeared after building to iOS14 with xcode12.
I have a section header with transparent background, on iOS14 it becomes white with new _UISystemBackgroundView
added to the hierarchy.
iOS 14 comes with new two cell configurations:
UIContentConfiguration
As the name suggests, content configurations can help you manipulate the content of the cell like image, text, secondary text, layout metrics and behaviors.
UIBackgroundConfiguration
can help with the manipulation of background color, visual effect, stroke, insets and corner radius. All cells will inherit a default background configuration even if we don’t specify one.
To get rid of the default iOS14 white background you need to change the UITableViewCell
or UITableViewHeaderFooterView
backgroundConfiguration as follows
// Add this code in your AppDelegate didFinishLauncingWithOptions
// or you can change configuration of certain subclass using self. backgroundConfiguration = ...
if #available(iOS 14.0, *) {
var bgConfig = UIBackgroundConfiguration.listPlainCell()
bgConfig.backgroundColor = UIColor.clear
UITableViewHeaderFooterView.appearance().backgroundConfiguration = bgConfig
//For cell use: UITableViewCell.appearance().backgroundConfiguration = bgConfig
}
Read this article for more