views:

1133

answers:

4

I have almost 20 images in PNG format added to my current project on Xcode (under the proper group, Resources). Unfortunately, library window's Media tab doesnt show some of them. And if I create an UIImageView and set one of these invisible images from code, nothing shows up. I also tried from IB with adding a UIImageView and set its source image.

Is this problem a image format related issue or is there a tiny detail I'm missing.

What log says:

Could not load the "07_clock_icon.png" image referenced from a nib in the bundle
A: 

If you dragged the images from the Finder into the Resources folder in XCode the images should show up in IB as well. At least it does so in my setup.

Maybe the images are 8-bit PNG images. I believe Cocoa requires them to be 24-bit because of the alpha transparency. PNG 8-bit doesn't support the alpha channel, as it's more like a GIF image.

But from the error you posted It seems IB couldn't find the resource at all. Which is understandable if it doesn't load the resources from XCode in its library.

mensch
All of the images are 24-bit.
Burcu Dogan
A: 

Assuming you selected the option to let XCode copy the files into your project and neither XCode nor the Finder complain when you make the copy... I wonder if there might be some file corruption? Maybe try recreating them or opening and resaving them from another graphics application (or even Preview.app).

btw- 8-bit PNGs have worked fine for me.

Meltemi
A: 

Heyy! I figured it out. It's a refreshing bug. So just copy and replace those images that did not load into your project folder, and then hold Shift Command K (to clean your project). After Clean Up it should work perfectly! Enjoy!

Victor Alexander
“copy and replace those images … into your project folder”? Can you clarify your answer, please?
Peter Hosey
Sorry, Go into your folder and select the images that didn't load, then copy them onto your desktop for the moment. Go back to Xcode and select the images that didn't load and delete them, and click ALSO MOVE TO TRASH.Then drag the images you placed on your desktop to the xcode window, and make sure to check the "Copy items into destination group's folder" Then just re-add the new images on Interface Builder, preform the clean up command, and build your project. It should work.
Victor Alexander
Adding resource again? I had over 200 images -- not working.
Burcu Dogan
A: 

this is a error in the image.I try all and what give me the idea was that i try to open the file in photoshop and give a error, just open with preview and resave fix the problem. I hope this helps

edgard