应用程序简介后,TabBar会更改样式

时间:2013-08-04 13:59:07

标签: ios uitabbarcontroller tabbar uitabbaritem

我遇到以下问题: 我的tabBar的设计在AppDelegate.m中设置:

       self.tabBarController = (UITabBarController*)self.window.rootViewController;
            UITabBar     *tabBar = self.tabBarController.tabBar;
            UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
        tabBarItem1.title = @"Start";
   // ...
         [tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:@"start_selected.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"start.png"]];
  // ...

但是在第一次介绍pageViewController之后,用户通过一个警告在我的tabBarController中打开它,然后返回tabBarController。但是然后appDelegate中的所有tabBar设置都消失了......

...返回tabBarController的方法:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MyStoryboard" bundle:nil];
        TabBarViewController *vc = (TabBarViewController *)[storyboard instantiateViewControllerWithIdentifier:@"TBVC"]; //this is the tabBarController in the InterfaceBuilder
        [self vc animated:YES completion:nil];

更新

...我在appDelegate中打开了介绍:

 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
            self.viewController = [[IntroViewController alloc] initWithNibName:@"IntroViewController" bundle:nil];
            self.window.rootViewController = self.viewController;
            [self.window makeKeyAndVisible];

也许有人可以帮助我,我希望我的第一个问题不是那么糟糕。

1 个答案:

答案 0 :(得分:0)

当你回去时,你正在实例化一个新的tabBar控制器。这意味着它与您使用自定义设置配置的不同。

相反,请关闭警报或正确显示的警告。