Swift 3 - UISplitViewController - Hide / expand the main view in the landscape (for example, the Notes application)

Just started with Swift and would like to reproduce some of the features found in the standard Apple Notes application. In particular, the "Expand" button, which is displayed in the "Details" window when the iPad is in landscape mode.

i.e.

Expand Button in Notes App

The next thing I came (as a simple quick fix) is to add the following to AppDelegate:

splitViewController.preferredDisplayMode = .primaryOverlay 

However, although this allows you to switch the main view in landscape orientation (similar to the default behavior by default), this is done using the "Master View" as a refill / overlay. However, I would prefer the behavior present in the Notes application in that the master view slides to / from (without imposing granularity).

Edit: Also interested in how to show only the corresponding button only in landscape mode on the iPad.

Any help would be greatly appreciated! Thanks

+7
swift master-detail uisplitviewcontroller uisplitview
source share
1 answer
 splitViewController.preferredDisplayMode = .allVisible 

That should do the trick. It turns the Master View slide on and off when switching to full screen mode.

+7
source share

All Articles