How are the icon files in my application bundle used on iPad and iPhone?

來源:互聯網
上載者:User

http://developer.apple.com/library/ios/#qa/qa2010/qa1686.html

 

 

Technical Q&A QA1686App Icons on iPad and iPhone


Q: How are the icon files in my application bundle used on iPad and iPhone?

A: Below are guidelines for handling icon files for iPhone-only apps, iPad-only apps, and universal apps.

IMPORTANT: Icons marked with "Required" must be supplied in your application bundle.

iPhone-only Apps

Include the following in your application's Resources group in the Xcode project:

Table 1 : iPhone-only apps icon requirements.

Image Size (px) File Name Used For Required Status Notes
512x512 iTunesArtwork Ad Hoc iTunes Optional but recommended File should be in png format, but name it without the .png extension
57x57 Icon.png App Store and Home screen on iPhone/iPod touch Required <None>
114x114 Icon@2x.png Home screen for iPhone 4 High Resolution Optional but recommended <None>
72x72 Icon-72.png Home screen for iPad compatibility Optional but recommended <None>
29x29 Icon-Small.png Spotlight and Settings Optional but recommended <None>
50x50 Icon-Small-50.png Spotlight for iPad compatibility Recommended if you have a Settings bundle, otherwise optional but recommended <None>
58x58 Icon-Small@2x.png Spotlight and Settings for iPhone 4 High Resolution Recommended if you have a Settings bundle, otherwise optional but recommended <None>

Your Resources group should look similar to Figure 1:

Figure 1: Add files to Resources group

Except for iTunesArtWork icon, list the names of each of these files in the Icon files entry in the Info.plist, in the order shown in the table. Follow the steps in "Add Icon files in Info.plist" section below. See Figure 4.

Back to Top

iPad-only Apps

Include the following in your application's Resources group in the Xcode project:

Table 2 : iPad-only apps icon requirements.

Image Size (px) File Name Used For Required Status Notes
512x512 iTunesArtwork Ad Hoc iTunes Optional but recommended File should be in png format, but name it without the .png extension
72x72 Icon-72.png App Store and Home screen on iPad Required <None>
50x50 Icon-Small-50.png Spotlight on iPad Optional but recommended <None>
29x29 Icon-Small.png Settings on iPad Recommended if you have a Settings bundle, otherwise optional but recommended <None>

Except for iTunesArtWork icon, list the names of each of these files in the Icon files entry in the Info.plist, in the order shown in the table. Follow the steps in "Add Icon files in Info.plist" section below. See Figure 5.

Back to Top

Universal Apps

Include the following in your application's Resources group in the Xcode project:

Table 3 : Universal apps icon requirements.

Image Size (px) File Name Used For Required Status Notes
512x512 iTunesArtwork Ad Hoc iTunes Optional but recommended File should be in png format, but name it without the .png extension
57x57 Icon.png App Store and the Home screen on iPhone/iPod touch Required <None>
114x114 Icon@2x.png Home screen for iPhone 4 High Resolution Optional but recommended <None>
72x72 Icon-72.png App Store and Home screen on iPad Required <None>
29x29 Icon-Small.png Settings on iPad and iPhone, and Spotlight on iPhone Recommended if you have a Settings bundle, otherwise optional but recommended <None>
50x50 Icon-Small-50.png Spotlight on iPad Optional but recommended <None>
58x58 Icon-Small@2x.png Spotlight and Settings for iPhone 4 High Resolution Recommended if you have a Settings bundle, otherwise optional but recommended <None>

Except for iTunesArtWork icon, list the names of each of these files in the Icon files entry in the Info.plist, in the order shown in the table. Follow the steps in "Add Icon files in Info.plist" section below. See Figure 4.

Back to Top

Add Icon files in Info.plist

To add the Icon files entry you will need to manually edit your Info.plist.

Open your Info.plist in Xcode, and locate the "Icon file" entry. Click on the plus (+) button at the end of the entry to make a new key entry. as shown in Figure 2.

Figure 2: Add a new entry under "Icon file" key

Then, type "Icon files" in the key column (notice the "s" added), or choose "Icon files" from the drop down list, as shown in Figure 3.

Figure 3: Add "Icon files" key in Info.plist

Next, turn down the disclosure triangle on "Icon files" and add the entries for the icons for your application, as shown in Figure 4 and Figure 5:

Figure 4: Add icon file entries for iPhone-only or Universal apps.

Figure 5: Add entries for iPad icon files.

Note: If you don't provide one of the listed optional icons, the system will automatically scale one of your existing icons to an appropriate size. However, it is strongly recommended that your application supply all the icons listed with specific sizes needed.

///////////////////////////////////////////

http://www.cocoachina.com/bbs/read.php?tid-24549.html

 

以前貌似發現相關尺寸,這次來點詳細的,相信不少人用的到。。。。

從icon說起
命名方法,舉例
Icon.png                         57×57
Icon-72.png                   72×72
Icon-Small.png             29×29
Icon-Small-50.png       50×50
Icon@2x.png                114×114
Icon-Small@2x.png     58×58

另
iTunesArtwork               512×512

在info.plist使用key CFBundleIconFiles,注意與CFBundleIconFile區分開,CFBundleIconFiles的優先順序高於CFBundleIconFile
省略副檔名,直接寫Icon,會自動識別
如果要加副檔名,必須把所有的圖片名都添加到CFBundleIconFiles的array中
特別需要注意的是,如果想自動識別,命名必須嚴格按照標準,且key為string類型。如果不自動識別,key為array類似並將完整檔案名稱添加進去

Default命名方法

<basename><orientation_modifier><scale_modifier><device_modifier>.png

這個就不多說了,方法和icon是一樣的,只列出相關的尾碼

<basename>預設為Default,也可用UILaunchImageFile key設定,在這用Default舉例
<orientation_modifier> 旋轉方向

-PortraitUpsideDown
-LandscapeLeft
-LandscapeRight
-Portrait
-Landscape
None

也就是說你可以Default-Portrait.png 來表示豎屏時的載入映像,同樣也可以直接Default.png不指定方向

<scale_modifier>依然是為iphone4準備,用法和icon雷同
Default-Portrait.png與Default-Portrait@2x.png會自動識別

<device_modifier>區分裝置,有2個值
~iphone
~ipad
Default-Portrait~iphone.png與Default-Portrait~ipad.png會自動判斷裝置  同樣需要注意的一點,這個在icon裡面同樣適應,但是貌似現在沒有使用的必要,看來未來ipad的解析度也會擴充一倍?

如果使用了Custom URL Schemes,不多說了,格式如下,用法同上
<basename>-<url_scheme><scale_modifier><device_modifier>.png
如:
Default-myscheme.png與Default-myscheme@2x.png

圖片:
如果你的資來源目錄下有Button.png與Button@2x.png兩張圖片
那麼使用:
UIImage* anImage = [UIImage imageNamed:@"Button"];
將會自動識別圖片載入

 

////////////////////////////////////////////

Add a CFBundleIconFiles key of type Array to your Info.plist. The array should contain 2 string items: the filenames of the two icons. The OS will then automatically choose the correct icon for each platform based on their pixel dimensions.

You can keep the CFBundleIconFile key and have it point to the icon file for the iPhone for 3.0/3.1 compatibility.

Update May 2010: Apple now has Technical Note explaining this in great detail: Technical Q&A QA1686 – App Icons on iPad and iPhone

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.