I have an application that uses a UISplitViewController
as its window's root view controller. The app used what was the Master-Detail Xcode template when it was made. The master VC is a UITableViewController
which, when one of its cells are pressed, "hides" itself using
self.splitViewController?.hide(.primary)
We've updated the VC to be a double-column style split view controller introduced in iOS 14. The method does hide the primary column most of the time; however, there are two cases where our master view controller fails to be dismissed with this animation:
- Portrait mode on the iPhone
- Using the
Zoomed
"Display Zoom" on iPhone landscape mode
We have not had any issues with the iPad. The documentation for the hide(:_)
method reads
When you call this method, the split view interface transitions to the closest display mode available for the current split behavior where the specified column is hidden.
Clearly, though, there are conditions under which the primary column isn't hidden with this method. I have searched around for solutions about hiding the master view controller but most are lacking in relevance either because they are many years old (sometimes 10+) and/or not applicable to Swift or iOS 14 with the new split view controller styles.
Why is the column not always hiding? and How can I ensure that the master view controller disappears?