gpt4 book ai didi

ios - 在 UINavigationController 中推送 View Controller 时没有动画

转载 作者:搜寻专家 更新时间:2023-11-01 06:04:08 25 4
gpt4 key购买 nike

我有一个 Storyboard,其中包含一个 UITabBarController,每个选项卡都包含一个 UINavigationController。对于其中一个 UINavigationControllers,在推送或呈现 View Controller 时没有过渡动画。

至少有两种不同的情况会发生这种情况

1. 我设置了 Storyboard转场来推送 subview Controller 。在 TableView 中选择单元格时会触发 segue。 “动画”框被选中。

The Attributes of the segue

尝试以编程方式推送 subview Controller 会产生相同的结果。

self.navigationController?.pushViewController(nextController, animated: true)

2.尝试从导航 Controller 的 Root View Controller 模态呈现另一个 View Controller 时也没有动画。

modalViewController.modalTransitionStyle = UIModalTransitionStyle.flipHorizontal
self.present(modalViewController, animated: true, completion: nil)

如果我从另一个 View Controller 中显示 modalViewController,过渡是动画的,这让我相信正在显示的 Root View Controller 中有问题。

有没有办法禁用我可能不小心触发的 UIViewController 上的动画?我已经检查并确认没有 UIView.setAnimationsEnabled(false)

最佳答案

使用 self.navigationController?.pushViewController( 而不是 self.present(

您在 UINavigationController 中设置动画。但是你调用了UIViewController提供的self.present(函数,UIViewController当然不能提供动画。

关于ios - 在 UINavigationController 中推送 View Controller 时没有动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41855202/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com