Search code examples
iosswiftuiviewcontrolleruisplitviewcontrollerlaunch-screen

Present UIViewController at startup for an animating launch screen in UISplitViewController


I have a UISplitViewController for the rootViewController !

I don't know how to present a UIViewController for the animated launch screen !

In AppDelegate.swift I have:

class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    let splitViewController = window!.rootViewController as! UISplitViewController

    splitViewController.preferredDisplayMode = .allVisible
    splitViewController.preferredPrimaryColumnWidthFraction = 1.0
    splitViewController.maximumPrimaryColumnWidth = 360

    splitViewController.delegate = self

    return true
} ...

Where and how can I present a UIViewController in full screen "over" the UISplitViewController ?


Solution

  • You can set ViewController as rootViewController for window to show it in fullscreen mode. After that you can turn back SplitViewController for window.