Objective C: 导航标题被覆盖

Objective C: Navigation title is overridden

我有 3 个故事板,ABCA 有一个 TabBarController.

当我从 A 移动到 B 时,我将其设置为如下代码:

BViewController* vcB = (BViewController*) [R2Utils getViewControllerWithId:@"BViewController" fromStoryBoard:StoryboardB];
    [self.navigationController presentViewController animated:YES];

其中 vcB 是故事板 B 中的 NavigationController

B 导航到 C 时:

UINavigationController* nav = (UINavigationController*)  [R2Utils getViewControllerWithId:@"MainAppNavigationController" fromStoryBoard:StoryboardC];

[UIView transitionFromView:self.window.rootViewController.view
                                toView:nav.view
                              duration:0.8f
                               options:UIViewAnimationOptionTransitionFlipFromRight
                            completion:^(BOOL finished){
                                self.window.rootViewController = nav;
                            }];

问题是导航栏的标题被之前控制器的导航栏覆盖了(检查图片)。

问题很简单: 故事板 B 中的先前控制器仍处于层次结构中。故事板 C 中的 navigationController 有一个 backgoroundColor = [UIColor clearColor]。 所以在storyBoardC中,我们可以看到当前controller的title和storyBoardB

navigationController栏的内容