问题
So I just upgraded to the latest and greatest Xcode 4.4 but can't find Icon Composer. It was in the Open Developer Tool menu item in Xcode 4.3 but now I can't find it anywhere.
Did Apple forget to include it? How do I create icons without it?
I also tried using iconutil in Terminal but I'm getting an error that 1024x1024 is not supported. I am running OSX 10.7.4.
回答1:
My guess is that Apple doesn't want you using it anymore.
EDIT: The better way to do it is to add the .iconset
folder to the target in Xcode. Scroll down to Dvorak's answer, which is admittedly the better one.
The officially sanctioned way is now the iconutil
command instead.
From Apple's guidelines:
After you’ve created the necessary app icon assets, place them in folder a named
icon.iconset
. To create an.icns
file, useiconutil
in Terminal. Terminal is located in/Applications/Utilities/Terminal
. Enter the commandiconutil -c icns <iconset filename>
, where<iconset filename>
is the path to the.iconset
folder. You must useiconutil
, not Icon Composer, to create high-resolution.icns
files.
There's another relevant Apple doc that goes more in depth: High Resolution Resources.
For reference, the complete set of icons:
icon_16x16.png
icon_16x16@2x.png
icon_32x32.png
icon_32x32@2x.png
icon_128x128.png
icon_128x128@2x.png
icon_256x256.png
icon_256x256@2x.png
icon_512x512.png
icon_512x512@2x.png
Note the last one is the equivalent of 1024x1024, though it seems like iconutil wants it named 512x512@2x, at least in Lion. Make sure - this is key - that you have this exact set of files, or you will encounter errors. Notice the lack of an icon_64x64.png
, for instance.
回答2:
Let Xcode Create an icns File Automatically
Ideally, you would supply a complete set of icons. However, it is not a requirement to have a complete set; the system will choose the best representation for sizes and resolutions that you don’t supply. Each icon in the set is a hint to the system as to the best representation to use.
*
The set needs to be put into a folder with the .iconset extension. It might seem a little unusual for a folder to have an extension, but this extension is a signal to the system that the folder contains a set of icons.
*
Xcode automatically validates and converts an iconset folder to an icns file. All you need to do is add the iconset folder to your project and build the project. The generated icns file is added automatically to the built product.
*
Note: Don’t use Icon Composer—it can’t create high-resolution icns files.
Provide High-Resolution Versions of All App Graphics Resources
About High Resolution for OS X
回答3:
By the way,
it took my one hour to figure out why both iconsutil
and XCode
failed to generate the icons: I did include a 64x64 version, which is wrong! No 64x64 version is required.
回答4:
I created an Automator Workflow that takes a 1024 px PNG image as input and creates all the other formats inside an .iconset folder for you automatically. From a designers point of view not the best option, but perfect during development, because Xcode stops complaining about missing 16x16px formats:
https://github.com/audiocommander/Iconset-Generator
回答5:
Download Graphics Tools for Xcode 4.4.
回答6:
You can get the old one back!
- go to the dev page of apple and click below Xcode on "Looking for an older version of Xcode?"
- download xCode 4.2.
- when done open the .dmg file.
- go to finder and click "Go to folder".
- type "/Volumes/Xcode/Packages".
- right click "DeveloperTools.pkg".
- click open with "The Unarchiver" (if you don't have it its free in the App Store".
- extract it to your Desktop and open the folder.
- right click the payload file and open it with "Archive Utility".
- open the payload folder and go to Applications > Utilities.
- copy it to you application folder or somewhere else.
enjoy Icon Composer!
回答7:
Just thought i'd concur that Icon Composer 2.4 in Graphics Tools for Xcode 4.4. in xcode44graphicstools6938118a.dmg does not have support for 1024 sizes, the old 2.2 version does however.
回答8:
As of 2015 all of the other answers are way too much work or just plain wrong. It's as easy as this:
You don't have to do anything other than to create the image need in the following sizes:
16 x 16px
32 x 32px
64 x 64px
128 x 128px
256 x 256px
512 x 512px
1024 x 1024px
And then in Xcode in your project view click on Images.xcassets
and from finder drag the images into the AppIcon squares.
You don't have to painstakingly name files or create directories or move a directory into Xcode or any of it. Just drag the images in from finder.
Here is a video someone else made of where to drag the icons to in XCode:
http://www.youtube.com/watch?v=OQN_AwcF0GU&t=4m0s
回答9:
Iconsutil is the best way and the only one accepted by XCode 4.4 Take care to name your png files exactly as Vervious mentioned and to provide all the files, otherwise, doesn't work...
回答10:
Read this...
http://developer.apple.com/library/mac/#documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Introduction/Introduction.html#//apple_ref/doc/uid/TP40012302-CH1-SW1
... to get the naming convention for your png images.
1024x1024 is no longer supported. Instead use the 512x512@2x naming convention as per the instructions on the page of the link above.
You don't need to convert to an icns file anymore as xcode does this for you automatically, so you don't even need to use iconutil.
Here's how it works:
1) Just create a folder in your project with the extension .iconset 2) Put all your png's in it but make sure that they all are named appropriately as per the instructions given by following the link above. 3) Compile the project as usual.
Xcode does the rest.
来源:https://stackoverflow.com/questions/11660736/xcode-4-4-removed-icon-composer-in-developer-tools