我有一个viewcontroller模式segra到tabbarcontroller,这个tabbar有4个项目,但只有一个项目在我测试应用程序时出现。
我用来调用tabbar的代码:
- (void)viewDidLoad{
[super viewDidLoad];
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"fundo_madeira.png"]];
NSLog(@"%i", [[NSUserDefaults standardUserDefaults] integerForKey:@"jacadastrou"]);
}
-(UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}
- (void)viewDidAppear:(BOOL)animated
{
[self performSelector:@selector(showTabBarController) withObject:nil afterDelay:0.0];
}
- (void)showTabBarController
{
if ([[NSUserDefaults standardUserDefaults] integerForKey:@"jacadastrou"] == 10) {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
vc = [[UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil] instantiateViewControllerWithIdentifier:@"TabBarSemLogin"];
} else {
vc = [[UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil] instantiateViewControllerWithIdentifier:@"TabBarSemLogin"];
}
[vc setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
} else {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
vc = [[UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil] instantiateViewControllerWithIdentifier:@"TabBarLogin"];
} else {
vc = [[UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil] instantiateViewControllerWithIdentifier:@"TabBarLogin"];
}
[vc setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
}
[self presentViewController:vc animated:YES completion:nil];
}
编辑:
我的故事板的屏幕截图: