在启动时为UISplitViewController

时间:2017-07-13 10:25:35

标签: ios swift uiviewcontroller uisplitviewcontroller launch-screen

我有一个用于rootViewController的UISplitViewController!

我不知道如何为动画启动画面呈现UIViewController!

在AppDelegate.swift中我有:

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
} ...

我在哪里以及如何在UISplitViewController上“全屏”呈现UIViewController?

2 个答案:

答案 0 :(得分:0)

在您可以调用SplitViewController的ViewController中:

let newVc = ViewController() //change this to your class name
self.splitViewController?.presentViewController(vc, animated: true, completion: nil)

答案 1 :(得分:0)

您可以将ViewController设置为rootViewController for window,以全屏模式显示它。之后,您可以将SplitViewController转回窗口。