【IOS】啟動畫面

來源:互聯網
上載者:User

標籤:style   ext   color   使用   strong   os   

總述:

兩種方式,一種是使用系統內建的,按規則定義啟動圖片名稱即可,顯示為1秒,要想延長時間,用[nsthread ? sleepForTimeInterval:5.0] ,另一種就是自訂uiivew,加到window中去。


祥述:

1,準備圖片資源,放入工程中,即可,預設時間為1s

      iOS裝置現在有三種不同的解析度:iPhone 320x480、iPhone 4 640x960、iPad 768x1024。以前程式的啟動畫面(圖片)只要準備一個 Default.png 就可以了,但是現在變得複雜多了。下面就是 CocoaChina 會員做得總結

  如果一個程式,既支援iPhone又支援iPad,那麼它需要包含下面幾個圖片:

Default-Portrait.png iPad專用豎向啟動畫面 768x1024或者768x1004

Default-Landscape.png iPad專用橫向啟動畫面 1024x768或者1024x748

Default-PortraitUpsideDown.png iPad專用豎向啟動畫面(Home按鈕在螢幕上面),可省略 768x1024或者768x1004

Default-LandscapeLeft.png iPad專用橫向啟動畫面,可省略 1024x768或者1024x748

Default-LandscapeRight.png iPad專用橫向啟動畫面,可省略 1024x768或者1024x748

Default.png iPhone預設啟動圖片,如果沒有提供上面幾個iPad專用啟動圖片,則在iPad上運行時也使用Default.png(不推薦) 320x480或者320x460

[email protected] iPhone4啟動圖片640x960或者640x920

?

  為了在iPad上使用上述的啟動畫面,你還需要在info.plist中加入key: UISupportedInterfaceOrientations。同時,加入值UIInterfaceOrientationPortrait, UIInterfacOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight。


2,如果想想設啟動畫面的顯示時間,

在XXXAppDelegate.m的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions方法中插入以下一行代碼:


  // Insert delay of 5 seconds befor the splash screen disappers.


  [NSThread sleepForTimeInterval:5.0];  // 其實這一行代碼也可以不加,因為預設情況下歡迎介面的時間只有一秒,加這一句是為了延長


 歡迎介面的展示時間到5秒,時間大家可以自己定義。


3,在XXXAppDelegate.m的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions 中通過使用uiview或uiimageview等控制項自訂啟動畫面

我在接快用蘋果助手的sdk的時候 要求啟動Icon 使用他們提供的圖片 於是按命名規則製作一套 發現啟動畫面黑屏 不顯示

改了之後就顯示了

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.