When trying to add image files to Images.xcassets, there are certain images that I cannot add. I've tried both dragging-and-dropping as well as using "+" followed by "Import". In the drag-and-drop case, nothing happens. In the Import case, the files I'd like to import are grayed out and cannot be selected.
I'm using Xcode 5.0.2 and I'm trying to import a JPG that's 60x105 pixels, with no transparency or layers.
However, some image files I can import. It's just that the ones I want I cannot for some reason. Are there limitations to the types of images you can import? I've done some googling, searching on forums, and in online developer help for more information about that but haven't found any explanation of any specific limitations on what you can import. Suppose then that no limitations exist, then is there another possible reason why can't I import some of these files?
As an added mystery, the images I'm trying to add are images I've downloaded to do the homework for Stanford's CS 193p course on iPhone programming available on iTunes. I watched the professor of the course drag-and-drop these very files into his Images.xcassets with no problem. So why can't I do that? It seems like I must be missing something obvious!
I'm very stuck on this and I would appreciate any suggestions!
Thanks, Mark Xcode 5, OS X Mavericks (10.9.1)
I've only ever had luck using PNG images inside the asset catalog. You can use the Preview to open your JPEG image and Export it to PNG.
I had a similar issue when trying to add a PNG file as well. I tried Importing as well as drag & dropping, and it simply wouldn't work (wouldn't give me an error, either). For some reason, I had to ensure that the filename ended in lowercase ".png" as opposed to ".PNG".
Not sure why it happened, but simply renaming the extension to lowercase ".png" seemed to fix the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With