swift - 如何在更改 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
})
解决方案
推荐阅读
- google-cloud-platform - DNS 无法解析来自本地网络的 GCP 虚拟机
- c# - 如何将数据从 ASP 表单添加到 MongoDB 集合?
- javascript - 获取没有类和id的div内的元素
- recovery - Ceph 回填和可用空间减少
- r - 条件数据操作任务
- laravel - 如何在laravel中关联三个表
- azure - 用于检测过去 7 天内没有成功的管道运行的 Log Analytics 警报
- android - RecyclerViewAdapter 的 onBindViewHolder() 出错
- ajax - 关闭或提交后以模式重置表单
- label - 打开或转换旧的 .LAB 文件