2013-10-28 55 views
-4

現在我正在使用Xcode 5創建應用程序。我的問題與啓動圖像有關。 我的問題是,當應用程序突然啓動時會出現黑屏,然後啓動屏幕(Aditional viewcontroller用於閃屏)平穩加載。 我已經設置了default.png(320 * 480)作爲啓動圖像。在Xcode 4.5中,它工作的很完美。我不是爲什麼當應用程序啓動時出現黑屏而不是default.png。我錯過了什麼?爲Xcode 5啓動圖像

...高級謝謝...

這是我的代碼使用spashviewController:

Appdelegate *appdelegate=(Appdelegate*)[[UIApplication sharedApplication] delegate]; 
int ht=[UIScreen mainScreen].bounds.size.height; 
////NSLog(@"ht is %d",ht); 
[self.view setFrame:CGRectMake(0, 71, 320,ht-64)]; 
if(appdelegate.window.frame.size.height==568) 
{ 
    // code for 4-inch screen 
    ////NSLog(@"iPhone 5 Screen"); 
    ////NSLog(@"main view nd main image view is resizable so noo need to set frame,just change the the image of main image view"); 
    backgroundimage.image=[UIImage imageNamed:@"[email protected]"]; 
    activityIndicator.frame=CGRectMake(141,476,20,10); 

} else { 
    backgroundimage.image=[UIImage imageNamed:@"default.png"]; 
} 
+0

請格式化您的代碼。 – Popeye

回答

1

啓動時沒有任何與你寫任何代碼有一個黑色的屏幕 - 它總是意味着你沒有以正確的方式定義默認圖像。

嘗試使用資產目錄作爲您的啓動圖像,並設置所有必需的默認圖像 - 如果它只是iPhone,則爲320x480,640x960和640x1136。

您可以通過在項目 - >常規頁面中單擊使用資產目錄來創建資產目錄。