2011-07-21 34 views
0

我有一個應用程序/遊戲,我想在顯示任何形式的UITabBarController之前顯示一系列視圖控制器(即:開始遊戲,加載遊戲等)。如何在UITabBarController之前啓動視圖控制器?

的過程會是:

  1. 啓動應用程序委託
  2. 啓動我的一系列視圖控制器的
  3. 只有當啓動遊戲已經推出按/顯示的UITabBarController。

我的UITabBarController是聯繫在一起的應用程序委託,和我當前的代碼是這樣的:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 

    SplashScreenVC *splashScreenVC = [[SplashScreenVC alloc] initWithNibName:@"SplashScreenVC" bundle:[NSBundle mainBundle]]; 


    UINavigationController *firstView = [[UINavigationController alloc] init]; 
    [firstView presentModalViewController:splashScreenVC animated:NO]; 
    [firstView release]; 


    [splashScreenVC release]; 
    [self.window addSubview:[tabController view]]; 
    return YES; 
} 

我嘗試啓動閃屏作爲一個模式視圖控制器,但是這似乎並沒有工作。

我也嘗試啓動它作爲initWithRootViewController - 但不管我做了什麼UITabBar仍然啓動,我從來沒有看到模態視圖。

那麼,如何在tabBarController視圖之前啓動東西,視圖等?

非常感謝

回答

1

爲什麼不把tabbar隱藏起來?

+0

我會研究認爲,看看是否」我會工作。理想情況下,儘管我會告訴應用程序委託在標籤視圖控制器之前啓動某些視圖;但如果這不起作用,我會試着隱藏標籤欄,看看是否能解決問題。 – zardon

+0

您實際上可以做另一件事情...添加TabBar之後,只需將您的ViewController的視圖添加到窗口。當你不再需要它們時,只需:[self.view removeFromSuperview]; ViewController的視圖將在tabbar前面,因此您不必擔心將其設置爲不可見。 – Peres

+0

我會給它一個去.. – zardon

1

你知道iOS響應者鏈嗎?如果你想顯示UI,必須在窗口上添加UI。 所以應該在窗口上添加飛濺(頂部的第一個索引只是「隱藏的tabbar」),您將看到顯示效果,然後在顯示Splash之後,您將看到正常的tabbar。

注:

  1. [self.window bringSubviewToFront:self.splashView]; //頂部

  2. [self performSelector:@selector(removeSplashView) withObject:nil afterDelay:5]; // 5秒後飛濺會自動消失

相關問題