Setting backgroundColor of UITableView instance has no effect when it is a subview of a UIView instance

Originator:shawnthroop
Number:rdar://47653386 Date Originated:January 30 2019
Status:Open Resolved:
Product:iOS SDK UIKit Product Version:12.1
Classification:UI/Usability Reproducible:Always
 
Summary: When a UITableView instance is the subview of a UIView instance unassociated with the view property of a UIViewController, setting the backgroundColor has no effect on the background color of the table view.

Steps to Reproduce:
1. Set the backgroundColor property of a UITableView instance to UIColor.red. The UITableView instance needs to be the subview of a UIView instance unassociated with a UIViewController.

Expected Results:
The UITableView instance's background color will be UIColor.red.

Actual Results:
The UITableView instance's background color remains UIColor.white

Version/Build:
Swift 4.2

Configuration:
See attached TableViewBackgroundColor.playground

Additional Comments: 
Calling UITableView.appearance().backgroundColor = .clear changes all UITableView instances backgroundColor to UIColor.clear. This is non-obvious, buggy, and may not be the intention for all use cases of UITableView.

Attachments: 
TableViewBackgroundColor.playground - https://d.pr/free/f/i2ZnDY

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!