实例化没有Segue的标签栏控制器

时间:2013-10-23 17:49:09

标签: ios iphone objective-c uitabbarcontroller uistoryboardsegue

在所有其他情况下,我使用segue转换到标签栏控制器,但我现在需要加载没有segue的标签栏控制器。要使用常规视图执行此操作,我将使用此:

EditProfileView *view = [[self storyboard] instantiateViewControllerWithIdentifier:@"editProfileView"];
[self.navigationController pushViewController:view animated:YES];

EditProfileView是我的标签控制器上的标签之一。如何更改此选项以便加载所有选项卡?

1 个答案:

答案 0 :(得分:2)

您应该推送UITabBarController。 e.g。

UITabBarController *tc = [[self storyboard] instantiateViewControllerWithIdentifier:@"tabbarcontroller"];
[self.navigationController pushViewController:tc animated:YES];

确保tabbarcontroller的故事板ID相同

另外,如果您想要呈现一个特定的viewcontroller:

[tc setSelectedViewController:[tc.viewControllers objectAtIndex:0]];
相关问题