当我从designworks.xib(designworks.m,designworks.h)切换到MainStoryboard FirstViewController(它是一个标签栏控制器,第一个控制器在标签外)时,它会加载故事板上的内容,但它不会加载底部的标签栏导航。
- (IBAction)backToHome:(id)sender {
/*
FirstViewController *fvc = [[FirstViewController alloc] initWithNibName:nil bundle:nil];
[self presentViewController:fvc animated:YES completion:nil];
*/
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
FirstViewController *fvc = [storyboard instantiateViewControllerWithIdentifier:@"FirstViewController"];
fvc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:fvc animated:YES completion:nil];
}
答案 0 :(得分:3)
检查你是否以这种方式完成了
将视图控制器添加到tabbarcontroller。
确保已在.h文件中添加此内容
@property (nonatomic, strong) UITabBarController *tabController;
在.m文件中合成tabController和
FirstViewController *fistView = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
ThirdViewController *thirdView = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
NSArray *viewControllersArray = [[NSArray alloc] initWithObjects:fistView, secondView, thirdView, nil];
self.tabController = [[UITabBarController alloc] init];
[self.tabController setViewControllers:viewControllersArray animated:YES];
现在将其呈现为模态
[self presentViewController:self.tabController animated:YES completion:nil];
答案 1 :(得分:1)
如果您的第一个视图控制器位于标签栏控制器内,请改为使用标签栏控制器。