echo "${built_products_dir} Run Path
echo "${srcroot}" project path
ifs=$ ' \ n '
echo $ (Find ${srcroot}-name "[email protected]")
This command $ {srcroot} folder recursively searches for files [email protected]
Modify the app icon's script
ifs=$ ' \ n '
#1
Path=${path}:/usr/local/bin
#2
Target_path= "${built_products_dir}/${unlocalized_resources_folder_path}/[email protected]"
base_image_path=$ (Find ${srcroot}-name "[email protected]")
#3
Convert Betaribbon.png-resize 120x120 resizedbetaribbon.png
#4
Convert ${base_image_path}-fill white-font times-bold-pointsize 18-gravity south-annotate 0 "Hello World"-| Composite Resizedbetaribbon.png-${target_path}
1. If you omit the first line, the compilation will fail. Your terminal has a variable called path that stores some of the default local scripts. For all command terminals that this is the first, the default is not a part of UNIX. This allows any command that is located in a directory path to run without specifying the full command location. Xcode needs to share the same path variable with your terminal. This line adds/user/local/bin to the path variable, where homebrew is installed.
2, the next two lines, get the local app icon, and then save the path to the Target_path and Base_image_path variables respectively
3, this line is to change the size of the betaribbon.png icon to the appropriate size;
4, the last line did two things. First, it adds the "Hello World" text to the original app icon. The script then performs the compositing function--placing a picture of the beta logo on top of it. Then save the synthesized picture as an app icon.
Hint: The application icon name is not arbitrary. In the final product, the name of the application icon must look like [email protected]. Xcode uses this naming convention to determine which icon to use based on the device.
Path=${path}:/usr/local/bin
ifs=$ ' \ n '
function Generateicon () {
Base_image_name=$1
Target_path= "${built_products_dir}/${unlocalized_resources_folder_path}/${base_image_name}"
base_image_path=$ (Find ${srcroot}-name ${base_image_name})
width=$ (Identify-format%w ${base_image_path})
Convert betaribbon.png-resize $WIDTHx $width resizedribbon.png
Convert ${base_image_path}-fill white-font times-bold-pointsize 18-gravity south-annotate 0 "Hello World"-| Composite Resizedribbon.png-${target_path}
}
Generateicon "[Email protected]"
Generateicon "[Email protected]"
Generateicon "Appicon76x76~ipad.png"
Generateicon "[Email protected]~ipad.png]
This access to this argument is done by using $ $, and setting the variable base_image_path.$ {Base_image_path} and then placing [email protected] before placing the place.
You will find a new feature of ImageMagick, Identity, which will get information about the image. In this case, you want to use the-format%w to get the width in identify, to go back and change the size of the betaribbon.png.
font_size=$ (Echo $WIDTH *. bc-l) sets a variable width of one-fifth for a font_size variable. Because UNIX arithmetic does not support floating-point arithmetic, you must use the BC program. The abbreviation for basic calculator, BC is capable of handling floating-point type calculations.
buildnumber=$ (/usr/libexec/plistbuddy-c "Print cfbundleversion" "${project_dir}/${infoplist_file}")
The build number of the version can be found in cfbundleversion in Info.plist
Convert ${base_image_path}-fill white-font times-bold-pointsize ${font_size}-gravity south-annotate 0 "$buildNumber" - | Composite Resizedribbon.png-${target_path}
ifs=$ ' \ n '
buildnumber=$ (/usr/libexec/plistbuddy-c "Print cfbundleversion" "${project_dir}/${infoplist_file}")
versionnumber=$ (/usr/libexec/plistbuddy-c "Print cfbundleshortversionstring" "${project_dir}/${infoplist_file}")
Path=${path}:/usr/local/bin
function Generateicon () {
Base_image_name=$1
Target_path= "${built_products_dir}/${unlocalized_resources_folder_path}/${base_image_name}"
Echo $TARGET _path
Echo $SRCROOT
echo $ (Find ${srcroot}-name "[email protected]")
base_image_path=$ (Find ${srcroot}-name ${base_image_name})
width=$ (Identify-format%w ${base_image_path})
Font_size=$ (echo "$WIDTH *." | bc-l)
echo "Font size $FONT _size"
if ["${configuration}" = = "Debug"]; Then
Convert Debugribbon.png-resize ${width}x${width} resizedribbon.png
Convert ${base_image_path}-fill white-font times-bold-pointsize ${font_size}-gravity south-annotate 0 "$buildNumber" - | Composite Resizedribbon.png-${target_path}
Fi
if ["${configuration}" = = "Beta"]; Then
Convert Betaribbon.png-resize ${width}x${width} resizedribbon.png
Convert ${base_image_path}-fill white-font times-boldr-pointsize ${font_size}-gravity south-annotate 0 "$buildNumber" - | Composite Resizedribbon.png-${target_path}
Fi
}
Generateicon "[Email protected]"
Generateicon "[Email protected]"
Generateicon "Appicon76x76~ipad.png"
Generateicon "[Email protected]~ipad.png]
IOS APPIcon Modify (script)