我正在进行从控制器A到控制器B的自定义推送转换。在控制器A中,导航栏被隐藏但在控制器B中可见。当我进行自定义转换时,导航栏会立即出现在转换的开始处。我怎么能阻止这个?
以下是一些代码:
在控制器A中,导航栏隐藏有以下代码:
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:YES animated:NO];
[super viewWillAppear:animated];
}
此外,在控制器A中,我使用以下代码开始自定义推送转换:
{
...
NOZViewController *vc = (NOZViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"gameController"];
[self.navigationController pushViewController:vc animated:YES ];
}
一旦自定义转换开始,我就会看到控制器B的导航栏! 以下是我如何获取转换的自定义动画代码的快照:
{
...
NOZMainViewController *fromViewCtrl =
(NOZMainViewController *)[transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
UIView *fromSnapshot = [fromViewCtrl.view snapshotViewAfterScreenUpdates:NO];
NOZViewController *toViewCtrl =
(NOZViewController *)[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIView *toViewSnapshot = [toViewCtrl.view snapshotViewAfterScreenUpdates:YES];
....
}
答案 0 :(得分:0)
我将导航栏设置为隐藏动画,解决了导航栏综合症的突然出现
- (void)viewWillDisappear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:NO animated:YES];
[super viewDidDisappear:animated];
}