2014-10-03 69 views
0

我知道這是壞的UX,但是客戶端要求每次用戶打開應用程序時顯示啓動畫面2秒。iOS - 每次應用打開時顯示啓動畫面

我試圖通過AppDelegate中通過實施這樣的:

  • 創建初始屏幕的一個實例變量的應用程序中查看控制器 :didFinishLaunchingWithOptions:方法中,和 設置其視圖的α爲0 。

    在applicationWillEnterForeground
  • 然後:我在 希望閃屏會顯示每個用戶打開 應用時,阿爾法設置爲1,然後設置阿爾法回到0 2秒後。

現在,這個工作,但不正確。當應用程序打開時,主界面會立即顯示,然後顯示啓動畫面。

當然,這不是打算在主UI之前顯示啓動畫面。

我試圖說服客戶端取消這個,但是沒有人知道它是如何正確實施的(以防他們完全堅持要他們)?

從應用中:didFinishLaunchingWithOptions:

_tabBarController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"TabBarController"]; 
[[self window] setRootViewController:_tabBarController]; 
[_tabBarController setDelegate:self]; 


_loadingViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoadingView"]; 
[[_loadingViewController view] setAlpha:0.0f]; 
[_loadingViewController willMoveToParentViewController:_tabBarController]; 
[_tabBarController addChildViewController:_loadingViewController]; 
[_loadingViewController didMoveToParentViewController:_tabBarController]; 
[[_tabBarController view] addSubview:_loadingViewController.view]; 

從applicationWillEnterForeground:

[[_loadingViewController view] setAlpha:1.0f]; 

[self performSelector:@selector(removeLoadingView) withObject:nil afterDelay:2.0]; 
+0

那麼你有默認啓動圖像無論如何這是不夠你的客戶? – Popeye 2014-10-03 14:22:47

+0

你的應用程序應該在返回後臺並返回活動狀態之後,返回到之前的狀態嗎? – Popeye 2014-10-03 14:23:19

+0

相信我,我曾嘗試過,但他們堅信,他們希望用戶每次打開應用程序時都能看到啓動畫面。 – Nick 2014-10-03 14:23:45

回答

0

這是一種解決方法,但你可以嘗試:

把一個UIImageView根視圖控制器。 (或者用閃屏圖像創建一個新窗口) 一旦真正的飛濺被移除,這個視圖就會顯示出來,然後你可以在你選擇的效果之後刪除它。

+0

它應該顯示隨後每次打開應用程序(按主頁按鈕,重新打開應用程序,按主頁按鈕,重新打開應用程序...)。 – Nick 2014-10-03 14:30:21

+0

正是因爲這一點,你應該能夠隨時顯示視圖,因爲它不是一個真正的飛濺屏幕。它只是一個你可以添加和刪除的視圖。 – Smiless 2014-10-03 14:33:24

+0

這就是我已經在做的事情。 – Nick 2014-10-03 14:34:12