由於隨着項目不但的版本迭代開發,資源也不斷的替換,如果沒有養成一個好的使用習慣,時間久了,自然就產生了好多的無用的圖片資源,下面就兩種方法幫你定位到無用的圖片
1. 利用工具 下載地址 http://jeffhodnett.github.io/Unused/ 運行效果如下
2. 通過終端 執行 shell 命令
a. 第一步建立.sh 文件 如 unusedImage.sh
- #!/bin/sh
- PROJ=`find . -name '*.xib' -o -name '*.[mh]'`
- for png in `find . -name '*.png'`
- do
- name=`basename $png`
- if ! grep -qhs "$name" "$PROJ"; then
- echo "$png is not referenced"
- fi
- done
b. 進入你要查找的工程目錄下執行 這段 shell 腳本