2013-08-04 34 views
0

我有以下問題: 我的TabBar的設計設置在AppDelegate.m:的TabBar改變風格後的應用程序,介紹

 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]; 

UPDATE

...我打開在應用程序中的介紹:

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

也許有人可以幫助我,我希望我的第一個問題不是那麼糟糕。

+0

請確保您沒有在viewDidLoad中加載的任何UIViewController中執行任何操作,這可能會導致此問題。 – Stavash

+0

@Stavash我做的唯一的事情就是設置一些徽章 – user2650439

回答

0

當你回去時,你正在實例化一個新的tabBar控制器。這意味着它不會與您用自定義設置配置的相同。

取而代之,關閉警報或任何它你正常顯示。

+0

我該如何避免這種情況...我對iOS編程非常陌生 – user2650439

+0

添加您在'介紹'階段中用於顯示警報的代碼 – Stavash

+0

我用更多的代碼更新了我的問題 – user2650439