TableView behavior in a SplitViewController


Rick Aurbach
 

Xcode 13.2.1, Simulator running iOS15.2 with 13.0 as a deployment target, UIKit.

I have a pretty standard configuration running an iPad in Simulator — SplitView master contains a TableView, secondary contains detail, displayed side-by-side. Tap on a master-view cell, the cell highlights and the detail VC (let's call it "detail-1") is displayed in the secondary view as expected. Now, do something that causes the secondary display to push a new view controller (which we'll call "detail-2") onto the secondary view. (i.e., we now have master on the left and detail-2 on the right)  The master cell unhighlights. And this occurs without triggering a UITableView.selectionDidChangeNotification.

In contrast, if I run the exact same code in Simulator, but for an iPhone (where the split view is implemented as a navigation controller), the master cell's highlight is not lost. (I.e., when I navigate back to the master view, the cell is still highlighted.

Does anyone have any insight as to what is going on and how to fix it? In my application, I want the selection highlighting of the selected cell in the master view to remain.