【发布时间】:2015-10-07 11:15:15
【问题描述】:
我想知道是否可以在没有标签栏和导航栏的情况下全屏推送NavigationController 的ViewController。我的问题如下:
我的应用程序在 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];
}
从SecondVC 到ThirdVC 我再次使用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