Search code examples
iosswiftuitableviewcocoa-touchuisplitviewcontroller

UISplitViewController and Cell Deselection


I seem to be having some weird issue with using a UISplitViewController and a UITableViewController.

What's happening is when I select a cell in the tableView it performs a segue and shows me a detail view (as Apple does in their example for UISplitViewController). The only issue is that when selecting the cell and performing the segue the cell becomes deselected for and for some odd reason I'm only experiencing this on iPhone+ (Landscape mode).

Here are some screenshot

On iPad working fine:

enter image description here

On the iPhone 7+ where it has this weird deselect issue, here is a gif:

enter image description here

You may not be able to see it but basically the selection (blue highlight) appears for a split second then immediately disappears.


Solution

  • Very strange, this seems to be a simulator bug.

    I tested out on a device and it's working properly.

    I also added this code into my MasterTableViewController's viewDidAppear method:

    self.clearsSelectionOnViewWillAppear = self.splitViewController!.isCollapsed