資源檔名稱 File Name
為了提高代碼的可讀性,圖檔名稱命名是非常重要,iOS圖檔命名只能為[ a-z, 0-9, _ ],好的命名規則可以幫助自己快速找到需要的圖檔資源。
圖檔名稱命名規則:
- 流水號請從0開始
- 請用「圖片類型_分類_用途_狀態.png。
- 圖檔格式以PNG為優先。次之JPEG,不建議使用GIF
- Resource 中文件的命名資源文件應該以小寫 + 下劃線" _ "的格式命名。
btn_share_facebook_normal.png
以下是對於圖片文件的命名規則Asset Type
| Assest Type | Prefix | Example |
|---|---|---|
| background | bg_ |
bg_author.png |
| Button | btn_ |
btn_send_pressed.png |
| Alert | alert_ |
alert_top.png |
| Divider | divider_ |
divider_horizontal.png |
| Menu | menu_ |
menu_submenu_bg.png |
| Notification | notifi_ |
notifi_bg.png |
| TableView | table_ |
table_pressed.png |
| image | img_ | img_sun.png |
對於圖標的命名習慣
| Asset Type | Prefix | Example |
|---|---|---|
| Icons | ic_ |
ic_star.png |
| Launcher icons | ic_launcher |
ic_launcher_calendar.png |
| Menu icons and Action Bar icons | ic_menu |
ic_menu_archive.png |
| Status bar icons | ic_stat_notify |
ic_stat_notify_msg.png |
| TableView icons | ic_table |
ic_table_recent.png |
| Alert icons | ic_alert |
ic_alert_info.png |
對於選擇器狀態的命名習慣
| State | Suffix | Example |
|---|---|---|
| Normal | _normal |
btn_order_normal.png |
| Pressed | _pressed |
btn_order_pressed.png |
| Focused | _focused |
btn_order_focused.png |
| Disabled | _disabled |
btn_order_disabled.png |
| Selected | _selected |
btn_order_selected.png |