我想知道是否可以将ViewController的NavigationController推送到全屏,而不需要选项卡和导航条。我的问题如下:
我的应用程序在TabBarController中嵌入了一个TabBarController。在NavController中,我显示了一个带有按钮的FirstVC,可以导航到另一个VC。现在我做一个模态演示来展示SecondVC。但是在这个SecondVC中,我有一个表视图,其中按钮返回一个ThirdVC。这个ThirdVC需要有FirstVC的导航条和选项卡。也许我需要向SecondVC展示NavigationController的第一个,但似乎我不能再现我的全屏动画.
简单地说:
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。结果是可以预测的:我没有导航条或选项卡。
我尝试了不同的东西,比如下面的那个或者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中的选项卡或导航栏.
发布于 2015-10-08 08:06:05
我在您的代码中添加了以下代码改进。
- (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。
https://stackoverflow.com/questions/32990754
复制相似问题