-2

I have a UITableViewController with a grouped table view. No matter what I try, I can't match dark mode colors of native Settings app of iOS 14. I tried the following:

     self.tableView.backgroundColor = UIColor.systemGroupedBackground
     

And in cellForItemAtIndexPath, I set

     cell.backgroundColor = UIColor.secondarySystemGroupedBackground

This matches colors for light mode but not for dark mode.

Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
  • 1
    Create a color whose dark mode variant does match the Settings app. What's the difficulty? – matt Apr 27 '22 at 21:30
  • Well custom colors are always an option but I assume native app uses native system colors that work for both the modes. – Deepak Sharma Apr 28 '22 at 08:20
  • And sticking to native colors will ensure consistency across iOS versions. I assume native settings app uses system colors only, but I may be wrong. – Deepak Sharma Apr 28 '22 at 08:47

1 Answers1

-1

The system colors work differently when view controller is presented modally as form sheet compared vs full screen. The look matches Settings app in dark mode when view controller's presentationStyle is overFullScreen. In other cases such as automatic, system colors are lighter!

Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
  • "when view controller is presented modally as form sheet" But that wasn't mentioned in the question. Sure, system dynamic colors respond to UIUserInterfaceLevel. It's part of the trait collection. – matt Apr 28 '22 at 10:56