Frage

I've the following problem: The design of my tabBar is set in 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"]];
  // ...

But after a first introduction pageViewController, which is opened in my tabBarController through an alert, the user goes back to the tabBarController. But then all my tabBar-settings from the appDelegate are gone...

...method to go back to the 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];

UPDATE

...I open the introduction in 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];

Maybe someone can help me and I hope my first question is not so bad.

War es hilfreich?

Lösung

When you're going back, you're instantiating a new tabBar controller. This means that it won't be the same one you've configured with your custom settings.

Instead, dismiss the alert or whatever it is you show properly.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top