UIImageView image not seen while set from Storyboard

808 views Asked by At

In a story board view, I am adding an image view as a subview. Then I set image for that image view. But, I cannot see the image for that image view. What I am seeing is just an question mark. Here is how it looks:

enter image description here


You can see that I have set an ChaptersBg as an image. I have added that in Assets.xcassets. My App is only for iPad, so chosen iPad in Devices. Here is how I have added that image:


enter image description here

I can see both the 1x and 2x images in the preview, but not in image view. Image view is of size 420 X 100. Thus 1x has resolution 420 X 100 and 2x has resolution 840 X 200.

Everything seems ok but I cannot see the image there. I also tried it by setting programmatically but no impact at all..

What may be the reason ???

EDIT 1:

When I (1) Remove constraints of image view (2) Set image programmatically —— then and then I can see image at runtime.

1

There are 1 answers

0
dorian On BEST ANSWER

Well it should work from what I see. Xcode gets weird sometimes when it comes to referencing resources. I recommend removing the images, clean and build and add again. See if it works.