UINavigationController back button not animating(UINavigationController 后退按钮没有动画)
问题描述
导航控制器的后退按钮动画有一个奇怪的问题:
I'm having a weird issue with a navigation controller's back button animation:
我的应用程序有一个带有 3 个选项卡的选项卡栏控件,其中一个有一个导航控制器和两个后续视图控制器,第一个只显示主表,第二个显示详细信息,当我点击后退按钮时出现问题从细节视图控制器,而不是滑回主视图控制器,它只是弹出没有动画的视图.
my app has a tab bar control with 3 tabs, one of them has a navigation controller with two subsequent view controllers, the first one just show a master table and the second one details, the problem comes when I tap the back button from the detail view controller, instead of slide back to the master view controller it just pops the view without animation.
我注意到,如果我先转到另一个选项卡,然后再返回此选项卡,动画将正常触发.
I've noticed that if I first go to another tab, and then return again to this one, the animation will trigger normally.
我已经从头开始重建了整个应用导航,但问题仍然存在,感谢任何帮助.
I've rebuilt the whole app navigation from scratch but the problem still persist, any help is appreciated.
提前致谢!
添加了更多信息
这就是我的故事板在那个特定分支中的样子:
This is how my storyboard looks like in that particular branch:
这是来自Partidos Activos"视图控制器的 prepareForSegue:
Here's the prepareForSegue from "Partidos Activos" view controller:
#pragma mark - Segues
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:@"PartidosEnDia"]) {
PartidosActivosEnFecha *paf = segue.destinationViewController;
CalendarCell *senderCell = (CalendarCell *)sender;
paf.datos = senderCell.dataDic;
}
}
两个 viewController viewDidLoad 方法都在方法开始时调用 super.
Both viewController viewDidLoad methods are calling super at the start of the method.
正如我之前所说,如果我只是点击其他选项卡然后返回到这个选项卡,Partidos Activos En Fecha"视图控制器的滑回动画按预期工作,只有当我启动应用程序并直接转到这个 viewController 当滑动返回动画不起作用时,它只是在没有动画的情况下到达调用者 viewController.
As I told before, if I just tap on other tab and then come back to this one, the slide back animation from "Partidos Activos En Fecha" viewController works as expected, it's only when I start the application and go directly to this viewController when the slide back animation doesn't work, and it just gets to the caller viewController without animation.
希望我添加了足够的信息,如果不告诉我,我会再次添加.
Hope I added enough info, if not just tell me and I will add it again.
推荐答案
我终于找到问题所在了,我在 viewDidAppear
方法中漏掉了一个对 super
的调用但在 UITabBarController
! 中,我只检查 viewControllers
的选项卡,而不是 tabbarviewcontroller
.@rdelmar 是对的.
I finally found where the problem was, I was missing a call to super
in the viewDidAppear
method but in UITabBarController
!, I was checking only viewControllers
for the tabs but not the tabbarviewcontroller
. @rdelmar was right.
这篇关于UINavigationController 后退按钮没有动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UINavigationController 后退按钮没有动画


基础教程推荐
- 固定小数的Android Money Input 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01