Subhajit Halder
Subhajit Halder

Reputation: 1423

Preview in Xcode not showing images from assets library

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

Upvotes: 7

Views: 9332

Answers (4)

Ahmed Abdallah
Ahmed Abdallah

Reputation: 2355

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.

Upvotes: 8

Declan McKenna
Declan McKenna

Reputation: 4870

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.

Upvotes: 0

Kent Robin
Kent Robin

Reputation: 2616

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.

Upvotes: 0

typedef
typedef

Reputation: 937

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

  1. Choose Assets.xcassets folder.
  2. in File Inspector - Target Membership should be checked.

Upvotes: 7

Related Questions