[英]How to segue from tab bar view controller to another view which is a child of a navigation controller
[英]How within a tab bar controller do I segue from one view controller to another and retain the tab bar?
我有一个应用程序,其中有几个视图控制器由标签栏控制器控制。 从我想要的其中一个视图控制器(在单击按钮上)转到另一个视图控制器并保留要查看的segued底部的标签栏。
我用过
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:@"newView"]){
UIViewController *controller =segue.destinationViewController;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
}
}
这样工作正常,除了从视图到视图中缺少标签栏(占位符在故事板中显示它,但在应用程序运行时它不会显示)我也尝试过更换
[self presentModalViewController:controller animated:YES];
同
[self presentViewController:controller animated:YES completion:nil];
但这也不起作用。
一些调试显示,对于segued-to视图控制器,tabBarController属性设置为nil。
反正有没有保留标签栏在segued-to视图控制器?
根据你的解释,我不认为你想要一个模态控制器。 模态用于叠加,使标签栏无效。 从故事板中,选择您的segue并选择推送,而不是模态。
Push vs Modal(注意标签栏):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.