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

1

12

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

Voyles answered 28/4, 2016 at 16:21 Comment(1)
Congrats, your question was well indexed by Google and got me here.Archbishop
H
11
splitViewController.preferredDisplayMode = .allVisible

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

Hoang answered 25/5, 2016 at 18:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.