0

当我从 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];
}
4

2 回答 2

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];
于 2013-04-10T11:47:13.067 回答
1

如果您的第一个视图控制器位于标签栏控制器内,请改为推送标签栏控制器。

于 2013-04-10T11:39:43.490 回答