3

当我初始化UITabBarController每个选项卡包含的位置时,每个选项卡UINavigationControllerUINavigationController包含UIViewControllerUIViewController我做类似的事情时

TSActivityDetailsVC * c = [[TSActivityDetailsVC alloc] initWithNibName:@"TSActivityDetailsVC" bundle:nil];
[self.navigationController pushViewController:c animated:YES];

我有动画,但是当我按下后退按钮时 - 我没有动画并出现错误

日志:

push view controller
Unbalanced calls to begin/end appearance transitions for <TSActivityMapVC: 0x81b1000>.
back btn pressed
Unbalanced calls to begin/end appearance transitions for <TSActivityDetailsVC: 0x81c85d0>.

初始化代码:

-(UITabBarController *) createMainTabBarController{
UITabBarController * tabbarCntr = [[UITabBarController alloc] init];
[tabbarCntr setViewControllers:[NSArray arrayWithObjects:
                                [[UINavigationController alloc] initWithRootViewController:[[TSActivityMapVC alloc] init]],                                    
                                [[UIViewController alloc] init],
                                [[UIViewController alloc] init],
                                [[UIViewController alloc] init],
                                [[UIViewController alloc] init]
                                , nil]];
[tabbarCntr.tabBar setSelectionIndicatorImage:[UIImage imageNamed:@"selection_indicator"]];
[tabbarCntr.tabBar setBackgroundImage:[UIImage imageNamed:@"tabbar_background"]];    

return tabbarCntr; 
}

TSActivityMapVC我执行

TSActivityDetailsVC * c = [[TSActivityDetailsVC alloc] initWithNibName:@"TSActivityDetailsVC" bundle:nil]; 
[self.navigationController pushViewController:c animated:YES];

令人惊讶的是,当我转到另一个选项卡并返回 - 之后 - 一切正常,没有错误

4

2 回答 2

10

我得到了解决方案!我继承了并忘记UITabBarController调用. 所以没有完成的过渡动画。viewWillAppearUITabBarController

这导致了“开始/结束外观的不平衡呼叫”!

于 2014-10-14T10:35:48.097 回答
1

最后我重现了你的错误。似乎您忘记在这两种方法中调用 super 。

-(void)beginAppearanceTransition:(BOOL)isAppearing animated:(BOOL)animated{
    [super beginAppearanceTransition:isAppearing animated:animated];
    NSLog(@"**************begin app tr");
}

-(void)endAppearanceTransition{
    [super endAppearanceTransition];
    NSLog(@"**************end app tr");
}

希望你的问题在这。

于 2013-02-19T15:28:37.967 回答