I have similar issue like I described here. And again I cannot find another hidden setting.
I used disclosure indicator for my table view cell. And working on iPhones/iPads with iOS 10+, iPhone with iOS 9 it looks fine, but not on iPad with iOS 9.
I have tried to set background for accessoryView, but it still the same.
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "tableCell", for: indexPath) as! TablesTableViewCell
cell.accessoryView?.backgroundColor = tableView.backgroundColor
if let tablesTable = fetchedResultsController?.object(at: indexPath) {
currentTableSession = TableSessionTable.getCurrentTableSession(table: tablesTable)
cell.tableNameLabel.text = tablesTable.tableName
print("cell.contant view")
print(cell.contentView.backgroundColor)
print("cell.accessory view")
print(cell.accessoryView?.backgroundColor)
print("tableview.background")
print(tableView.backgroundColor)
As per print, it's nil:
cell.contant view Optional(UIDeviceRGBColorSpace 0.976539 0.977373 0.915492 1) cell.accessory view nil
tableview.background Optional(UIDeviceRGBColorSpace 0.976539 0.977373 0.915492 1)
Also tried this:
tableView.cellForRow(at: indexPath)?.accessoryView?.backgroundColor = tableView.backgroundColor
Same result.
Any idea how to fix this?
I have found the solution! Thanks for Claude31 who helped me with with this issue on Apple Developers forum.
Finally I have found that the issue can be fixed by initializing backgroundView and setting colour:
let backgroundView = UIView()
backgroundView.backgroundColor = tableView.backgroundColor
cell.backgroundView = backgroundView
It works!