Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift 3 - UISplitViewController - Hide/Expand Master View in Landscape (e.g. Notes App)

Just started with Swift and would like to replicate some functionality present in the standard Apple 'Notes' app. Specifically the Expand button that appears in the Details View when on iPad in landscape mode.

i.e.

Expand Button in Notes App

The closest I have come (as a simple quick solution) is to add the following into AppDelegate:

splitViewController.preferredDisplayMode = .primaryOverlay

However although this allows for toggling the Master View in landscape orientation (similar to the default portrait behaviour), it is done with the Master View as a popover/overlay. I however would prefer the behaviour present in the Notes app in that the Master View slides in/out (without overlaying the Detail View).

Edit: also interested in how to only show the corresponding button only in Landscape mode while on iPad.

Any help would be greatly appreciated! Thanks

like image 991
Paul Popiel Avatar asked Apr 28 '16 16:04

Paul Popiel


1 Answers

splitViewController.preferredDisplayMode = .allVisible

This should do the trick. It makes the Master View slide in and out when toggling to fullscreen mode.

like image 126
Keiwan Avatar answered Oct 16 '22 23:10

Keiwan