【问题标题】:PushViewController in fullscreenPushViewController 全屏
【发布时间】:2015-10-07 11:15:15
【问题描述】:

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

我的应用程序在 TabBarController 中嵌入了 NavigationController。在NavController 中,我显示了一个FirstVC,带有一个导航到另一个VC 的按钮。现在我做一个模态演示来展示SecondVC。但是在这个SecondVC 中,我有一个表格视图,其中一个按钮返回一个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。结果可想而知:我没有导航栏或标签栏。

我尝试了不同的方法,例如下面的方法或将ChildView 作为子视图添加到我的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 中的标签栏或导航栏...

【问题讨论】:

  • 请出示您的代码。
  • @Kiritan 如果你想要导航栏而不是你必须推动。模态不起作用。
  • @NimitParekh 感谢您的帮助。
  • @Kiritan 您是否要访问SecondVC 中的UITabBarController
  • @NimitParekh 不,我不想访问 SecondVC 中的 TabBarController。仅在 ThirdVC 中。

标签: ios objective-c modalviewcontroller pushviewcontroller


【解决方案1】:

我在你做的是我添加了以下代码改进。

- (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.

【讨论】:

  • 感谢您的帮助!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多