all images in my storyboard are now ? images. This happened after I imported all media assets into a new .xcassets structure. The app runs fine and the images show when the app runs, but what can I do to restore them in the storyboard?
Remove the .png extension from the image names in the storyboard. Xcode5 now uses the image name, not the filename.
Try first to do a clean build. In a project including git repo I was facing this problem. It solved each time by just by clean building the folder:
⇧⌘K
or
Product-> Clean build folder
It's likely that the accepted answer will solve the problem. However, in the event that you're still scratching your head:
If you have a naming convention for assets that involves "." characters (for example, "icon.menu.normal.png"), you will find that XCode and IB will very happily cooperate before using .xcassets. If you then shift everything into .xcassets, you will find that all of a sudden:
- IB will show the images correctly provided you leave off the file extension. However, when the app runs, none of IB's correctly visible images will load;
- If you include the file extension in IB, IB will display them as broken question marks but they will display correctly in the app.
- If you use
imageNamed:
you find you need to include the file extension for assets, otherwise northing happens.
The solution? Don't use "." in your asset naming conventions (bad programmer). Using underscores ("_") works fine too, is just as legible and saves you a lot of hassle.
© 2022 - 2024 — McMap. All rights reserved.