如何在App Delegate中调用时使View Controller动画化

时间:2015-07-07 05:27:17

标签: ios swift

我正在从AppDelegate.swift文件中解除登录视图控制器。但是当我运行下面的代码时,视图控制器就会从屏幕上消失,我怎样才能让视图控制器滑下来。

var currentUser = PFUser.currentUser()

    if currentUser != nil {
        var dashVC = mainSB.instantiateViewControllerWithIdentifier("dashView") as! itsTimeDashVC
        window!.rootViewController = dashVC
        window!.makeKeyAndVisible()

    }

1 个答案:

答案 0 :(得分:0)

使用动画更新根视图,可能应该有效。我没有尝试过:

UIView.transitionFromView(self.window.rootViewController.view, toView: viewController.view, duration:0.6, options: UIViewAnimationOptions.TransitionFlipFromRight, completion: nil), completion: { (fininshed: Bool) -> () in

self.window.rootViewController = viewController

})