首页 > 解决方案 > 如何在更改 rootViewController 时添加封面垂直动画

问题描述

我可以从选项中添加动画。但它们都不是垂直覆盖的。如何添加封面垂直动画?

 guard let window =  UIApplication.shared.windows.filter({$0.isKeyWindow}).first else {
                return
            }

            guard let rootViewController = window.rootViewController else {
                return
            }

            let storyboard = UIStoryboard(name: "Main", bundle: nil)
            let vc = storyboard.instantiateViewController(withIdentifier: "x") as! xTabBarController
            vc.view.frame = rootViewController.view.frame
            vc.view.layoutIfNeeded()
            
            UIView.transition(with: window, duration: 0.2, options: .transitionCrossDissolve, animations: {
                window.rootViewController = vc
            }, completion: { completed in
                
            })

标签: swift

解决方案


推荐阅读