Reputation: 17530
From reading building logs of Xcode, I noticed that for PNG images in Groups, command like this is run:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng -compress "" resource_folder_path/image.png app_bundle_path/image.png
However, for Folder References, there are no separate copy commands for PNG images under these folders, but only one copy command for each folder reference:
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks img_folder_path app_bundle_path
Though I can't find the builtin-copy
command(Can any one tell me where is it?), it seems it does not pngcrush
PNG images. Is it true? If so, any good way to use Folder References to organize PNG images and still let Xcode pngcrush
these images when copying them into bundle?
Upvotes: 1
Views: 256
Reputation: 3151
If you use folder references Xcode won't do the PNG crushing automatically and you'll have to do the optimisation manually instead. To manually run pngcrush in your folder you can use the bash snippet provided in this answer:
find /path/to/directory -name "*.png" | while read filename; do
xcrun -sdk iphoneos pngcrush -iphone "$filename" "${filename}_crushed"
mv "${filename}_crushed" "${filename}"
done
If you don't like the command-line you can use an application like ImageOptim instead.
Upvotes: 1