Interface Builder doesn't show some of my resource images - cocoa

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 doesn't 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

The solution to this is a bit silly, but it definitely works:
Close XCode and the Interface Builder. Now, instead of opening XCode then opening the project, navigate to the project in Finder and double click on the project. When you open your xib file the blue file not found images will flash up, then be replaced with the correct images and the dropdown will show all your images in the Inspector.

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!

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.

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.

Same problem was encountered by me. The problem is with the image. The image has been some how corrupted.Try to open the image in photoshop and you will see it doesn't open with photoshop.
I solved the problem by changing the image format to PNG-24 and everything works fine for me.
Hope this will solve your issue.
Regards,
Rupesh R Menon

Related

ToolbarItem icon set after the loss

my English level is limited, it may be difficult to read, please understand.
I use the NSSidebarTemplate icon in the ToolbarItem control of the project. But every time you open the Xcode, will be lost, there is no way to use NSSidebarTemplate. The missing results are shown in the picture. Open the project will have a pop-up box prompts, probably meaning
The document "Main.storyboard" had an internal inconsistency that was
found and repaired.
I have no way to use this NSSidebarTemplate, but most of the other icons do not have such a problem, such as NSActionTemplate is normal
It comes from a template project from Apple. The image name is NSSidebarTemplate. You can see it by digging into the storyboard or xib xml:
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSSidebarTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="zzz-zzz-zzz">
There might have been a change in Xcode that made the image name displayed as 'Unknown' at some point, though internally it's still there.
This is also discussed here: The Sidebar Icon image name in OSX

Localizable xcassets files?

In previous versions of xcode you could set image files as localizable files and import different image files for different locales.
I cannot seem to do this using the new XCAssets functionality in Xcode 5. Is there a way to do this within the xcassets structure? Or do I have to import the images as separate files.
I've also looked for this, and after some time looking around it seems that is not possible for the moment using the xcassets, although it may change in the future... or not
Apple currently recommends that the launch image should simulate the app first screen but without content.
Apple launch images guidelines
Yes seems not possible with xcassets for now as per Macistador answer.

broken image in chrome and firefox works in safari

I have a logo that shows up in Safari but in Chrome it appears as a broken link and simply does not show up at all in Firefox.
<img src="images/logo-01.png"/>
I have re-uploaded it many times and have even tried alternative paths and file names.
anyone know how i might be screwing this up?
I ran into this same problem. For me, it turns out the image was corrupt. If i tried to open the png file up in photoshop, i would get an error saying it could not parse the file.
For whatever reason, safari could display the corrupt file, but chrome could not. This is how i fixed my issue. I noticed "preview" on my macbook could open the file fine. If you are using windows, possibly try paint or gimp or some other program besides photoshop.
I downloaded the corrupt file onto my macbook, opened it with preview (open with > preview)
In the preview app, go to file > duplicate, which makes a copy of your image
Save that duplicated image
As a test, i tried opening that new copied image in photoshop and i was able to!
Upload new file to website. I was able to view the image in chrome now.
Hope that helps anyone who ran into the same problem.
It could be an issue with your file structure. Right now your links are using relative paths (e.g. href="index.html"). This is fine if the file you're referencing is in the same directory as the current page file. But if your current page is located elsewhere, like in a 'pages' directory or something, then you need to tell the links to start from the site root. That would look like href="/index.html" (note the slash). So for the image, you'd have:
<img src="/images/logo-01.png"/>

Weird problem with Images Components

My problem is when I open my old project (project that work by same Delphi Version), I lost the entire image picture contents. By this I mean picture property is None.
When I open dfm with notepad, the picture property has Data but when I open it with delphi, its picture data will disapear. It seems that Delphi recognize picture data invalid.
(in this situation Delphi erase all data).
This happen with all Image Components and all Components that have Picture Property
I encounted this problem when I reinstall Delphi, and I am now running Delphi version 2007.
Your problem is probably caused by a missing package supporting the stored image format. Check for any image or graphics library that has been installed on your previous system and is missing in the current one. A good candidate for that is always GraphicEx.

Images showing up that shouldn't in iPad application

I have an iPad application which has many categorized images I need to switch between.
I store the categories in a database, along with the image prefix and number of images for that category. Using a random number in the range of 0-to-image_count_for_category, I get an image name like this:
[image_prefix][random_number].png => "SomeCategory3.jpg"
The images themselves are included in the project file structure and are not stored in the database.
All the image swapping is going fine. The problem lies in some of the image usage... I used to have an image "SomeCategory3.jpg", which was in the application, and has been displayed. Now, I replace the image named SomeCategory3.jpg, and the old image shows up ... Um ... how is that possible?
I have tried removing the app from the device, cleaning the project, re-building, and re-copying to the device for debug. Still, the old image comes up in that random rotation.
My app never copy the images anywhere. I simply reference them using the app folder with the image name appended.
I have verified that the old images are not in the folder or referenced by the project. I have viewed all the images in xcode to ensure the image displays properly.
Yet somehow ... the old image gets used in my random image swapping rotation.
It's driving me mad trying to figure out how the old image is there.
Any ideas?
Thanks!
Kevin
Xcode can't tell the image changed and did not overwrite the one in your app bundle's Resources folder. Right-click the image in your Xcode project and click "Touch" then rebuild. That or clean your target and rebuild.

Resources