当我从 designworks.xib(designworks.m、designworks.h)切换到 MainStoryboard FirstViewController(这是一个选项卡栏 Controller ,选项卡外的第一个 Controller )时,它会加载 Storyboard上的内容,但不会加载底部的标签栏导航。
- (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];
}
最佳答案
检查你是否这样做过
将 View Controller 添加到 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];
关于ios - 切换 View 时 presentViewController 不加载标签栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15924706/