Preview in Xcode not showing images from assets library
Asked Answered
K

4

7

the second image view's image is taken from asset library

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

I am using Xcode 7.2 enter image description here

Kopple answered 25/2, 2016 at 7:23 Comment(1)
you are getting any warning ?Agama
B
8

You have to do three steps:

  1. Open Xcode. Go to window and choose projects. From new menu choose delete derived data.

  2. Remove image from assets library. Set it again and link it to image view.

  3. Click cmd+shift+k to clean your project. After that run your app or put it in preview seen.

Burtie answered 25/2, 2016 at 8:5 Comment(0)
S
7

Try to check "target membership" of Assets.xcassets file.

  1. Choose Assets.xcassets folder.
  2. in File Inspector - Target Membership should be checked.
Semen answered 25/2, 2016 at 8:18 Comment(0)
T
0

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.

Tahoe answered 26/11, 2016 at 10:7 Comment(0)
D
0

There's a similar problem when trying to access images within your assets directly by name as seen below:

enter image description here

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.

Dioecious answered 23/5, 2018 at 11:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.