只出现第一个tabbar项

时间:2014-01-02 16:40:09

标签: ios objective-c uitabbarcontroller

我有一个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];
}

编辑:

我的故事板的屏幕截图:

enter image description here

0 个答案:

没有答案