the second image view's image is taken from asset library as you can see it is not referencing images from assets library but taking from the image file included in the project
You have to do three steps:
Open Xcode. Go to window and choose projects. From new menu choose delete derived data.
Remove image from assets library. Set it again and link it to image view.
Click
cmd+shift+k
to clean your project. After that run your app or put it in preview seen.
Try to check "target membership" of Assets.xcassets file.
- Choose Assets.xcassets folder.
- in File Inspector - Target Membership should be checked.
For others experiencing this or similar issue; The reason this happened to me was that I only supplied the @3x
version of the image in the asset folder. When I supplied @1x
and @2x
the images was shown as expected in the storyboard again.
This started happening when Xcode forced me to choose device in the storyboard.
There's a similar problem when trying to access images within your assets directly by name as seen below:
The image does not appear when you change the name of the image after adding it to a folder within assets.
To fix this follow Ahmed's answer.
To prevent this from happening name your images prior to placing them in folders or add them to assets without a folder.
© 2022 - 2024 — McMap. All rights reserved.