UITableView (UITableViewStyleGrouped) missing nice top padding in popovers

Usually, when I display a UITableView (UITableViewStyleGrouped) somewhere, there's a nice strip of gray padding at the top, above the first cell in the first section.

But, when displayed in a popover on an iPad, the same UITableView appears with the first cell aligned to the top edge, i.e., you can't see any gray padding.

If you drag the UITableView down with your finger, you can see that the padding exists, but as soon as you let go, the UITableView snaps back so that the top cell is aligned with the top edge.

Curiously, if the top section has a header string, the UITableView behaves as you would expect.

Any thoughts are appreciated!

You might be able to override this behavior by assigning a blank view to tableView.tableHeaderView with the height that you'd like, but there's more to this rabbit hole.

The visual style of table views in popovers is inconsistent across Apple's apps, like Calendar, Pages, and Numbers, so it's unclear what the right thing to do is.

Depending on the context, the table view's background color may be a flat gray instead of systemGroupedBackground, as recommended by the HIG. The padding you mentioned may or may not be present. The popover's drop shadow may be darker than the default.

When view controllers are pushed in the context of a navigation view controller in a popover, the popover may elegantly change size during the transition, compared to the default behavior which is to change size only after the push transition has completed. Animating the popover's size in concert with the push transition is tricky to achieve and requires a lot of experimentation.

I haven't looked at iOS 16 yet.

UITableView (UITableViewStyleGrouped) missing nice top padding in popovers
 
 
Q