2015-09-18 84 views
0

我想爲launch screen加上animating view,因此我必須使用story board or a xib/nib,因爲使用Apple's default launchScreen是不可能的。 但是當我要這樣做時,使用xib作爲啓動屏幕,有一個error,如launch screen may not have connections。 還有其他方式可以使用xib或storyboard作爲launchScreen。 任何幫助將不勝感激。是否可以使用動畫視圖作爲launchScreen?

+0

以下鏈接可以幫助你: http://stackoverflow.com/questions/27998284/launch-image-or-launch-xib-storyboard –

回答

0

不,用標準工具製作是不可能的。
您可以創建簡單的屏幕,顯示動畫,加載遠程信息並調用segue。
我選擇這種方式。

+0

能否請您詳細解釋,或用例子或演示闡述。 –

-1

您可以使用下面的代碼。它可能會幫助你。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
     if(isAnimationShow) 
     { 
       //do code for show animation in ViewController file. 
       ViewController *objlogin = [STORY_BOARD instantiateViewControllerWithIdentifier:@"ViewControllerVC"]; 
       [self pushViewController:objTimeSheetVC]; 
     } 
     else 
     { 
       HomeVC *demoViewController = [STORY_BOARD instantiateViewControllerWithIdentifier:@"HomeVC"]; 
       [self pushViewController:objTimeSheetVC]; 
     } 
} 
+0

你能解釋一下嗎? –

0

不能創建啓動屏幕動畫,但你可以創建一個假的閃屏視圖控制器並在其上添加動畫:

Here是我用LaunchScreen.storyboard一個示例項目爲...啓動畫面並在Main.storyboard中創建了FakeSplashScreenViewController。這個視圖控制器是我的窗口的根。我把動畫中viewDidLayoutSubviews

[super viewDidLayoutSubviews]; 
[UIView animateWithDuration:3.f 
       animations:^{ 
        self.myView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); // implement your anim here 
       } completion:^(BOOL finished) { 
        // Change the root view controller 
        UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"ViewController"]; 
        UIApplication *application = [UIApplication sharedApplication]; 
        AppDelegate* appDelegate = application.delegate; 
        appDelegate.window.rootViewController = vc; 
       }]; 
+0

您的示例項目中的錯誤.. –

+0

我在XCode 7(和iOS 9上的模擬器)上運行它沒有任何問題。什麼是錯誤? –

+0

我使用xcode 6和ios8 –

0

您可以使用一個視圖控制器,而不是和你想用它做什麼都。但必須先將主界面從LaunchScreen.xib更改爲Main。 enter image description here

+0

不能正常工作......只有黑屏出現,然後homeVC –

+0

是否使它成爲初始控制器。 –

+0

是的,我讓它初始控制器 –

相關問題