全屏 PushViewController

PushViewController in fullscreen

我想知道是否可以在没有标签栏和导航栏的情况下全屏推送 NavigationControllerViewController。我的问题如下:

我的应用在 TabBarController 中嵌入了 NavigationController。在 NavController 中,我显示了一个 FirstVC 和一个导航到另一个 VC 的按钮。现在我做一个模态演示来显示 SecondVC。但是在这个 SecondVC 中,我有一个表格视图,其中有一个按钮 returns 和一个 ThirdVC。这个 ThirdVC 需要有 FirstVC 的导航栏和标签栏。也许我需要在第一个 NavigationController 上按下来显示 SecondVC 但似乎我无法重现我的全屏动画...

为简单起见:

FirstVC ===> SecondVC (modal presentation) ====> ThirdVC (modal presentation):

这是我目前的应用,ThirdVC 上没有导航栏或标签栏。

提前致谢。

编辑

SecondVC 的模态表示是这样的:

- (IBAction)detailButtonClicked:(id)sender {
    SecondVC *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondVC"];
    vc.modalPresentationStyle = UIModalPresentationFullScreen;
    [self presentViewController:vc animated:YES completion:nil];
 }

SecondVCThirdVC 我再次使用 presentViewController 因为我不能在模态中使用 pushViewController。结果是可以预见的:我没有导航栏或标签栏。

我尝试了不同的方法,例如下面的方法或将 addChildView 作为子视图添加到我的 FirstVC:

- (IBAction)detailButtonClicked:(id)sender {
    SecondVC *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondVC"];
    UINavigationController *childNavigationController = [[UINavigationController alloc] initWithRootViewController:vc];
    childNavigationController.navigationBarHidden = YES;
    [self.navigationController presentViewController:childNavigationController animated:YES completion:nil]; 
}

并在 SecondVC

- (IBAction)changeButtonClicked:(id)sender {
    ThirdVC *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"ThirdVC"];
    [self.navigationController pushViewController:vc animated:YES];
 }

我也无法在 ThirdVC 中访问我的标签栏或导航栏...

我对你所做的是添加以下代码改进。

- (IBAction)buttonClicked:(id)sender {
    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main"
                                                             bundle: nil];
    SecondViewController *vc = (SecondViewController*)[mainStoryboard
                                          instantiateViewControllerWithIdentifier: @"SecondVC"];
    vc.delegate = self;

    [[APP_DELEGATE window] addSubview:vc.view];
    [self addChildViewController:vc];
}

主要代码行是addchildViewController.

Here You can download the sample code of yours.