在app init上加载多个viewcontrollers

时间:2015-12-30 15:43:59

标签: ios swift uiviewcontroller

我试图在启动画面后同时加载2个视图控制器。

这是我想要的堆栈:

SECOND VC - 目前正在观看

FIRST VC

Root VC

我通过在viewDidAppear下调用presentViewController方法对其进行了解决,但结果是root vc可见半秒然后FIRST VC加载然后最后加载SECOND VC。

这里的想法是首先看到SECOND VC,然后一旦被解雇它将向下滑动并显示FIRST VC最后隐藏到ROOT VC。

我应该用什么方法来实现这个目标?

编辑:以下是例子:

ROOT VC

override func viewDidAppear(animated: Bool){
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let firstVC: firstViewController = storyboard.instantiateViewControllerWithIdentifier("firstVC") as! firstViewController
        self.presentViewController(firstVC, animated: false, completion: nil)
}

FIRST VC

override func viewDidAppear(animated: Bool){
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let secondVC: secondViewController = storyboard.instantiateViewControllerWithIdentifier("secondVC") as! secondViewController
        self.presentViewController(secondVC, animated: false, completion: nil)
}

然后我会在SECOND VC和FIRST VC上有一个按钮来解雇它

0 个答案:

没有答案