Image not showing in UIImageView in Interface Builder / iPhone Image not showing in UIImageView in Interface Builder / iPhone xcode xcode

Image not showing in UIImageView in Interface Builder / iPhone


Try cleaning and rebuilding the project.

If it's still not working then remove all images from Xcode (select delete reference only) and then re-add them again by dragging those images into Xcode. Then re-build it and it should work.


My recipé: CLEAN + Build + QUIT XCODE AND THEN REOPEN IT!

Voilá!! It's there!


Make sure you have added your image to target when dragging it into the project. Because Xcode's folder / group / project system is buggy, click on the image and check that it is actually added to the target build in the inspector as shown (a graphical problem deserves a graphic answer!) :

Add the image to the project...

enter image description here

Add to targets... (or so we think)

enter image description here

Background image shows nicely in Interface Builder...

enter image description here

But when we run, we have nothing but the background color we set... no image...

enter image description here

Clicking on the UIImageView in Interface Builder and using the inspector, we scroll down and find that in fact it was never added to the target like Xcode clearly showed in step 2...

enter image description here

So we add it to the target...

enter image description here

And we build and run and voila! Our image shows in the UIImageView exactly where it is suppose to show.

enter image description here

This drove me nuts for the better part of the day until I tried adding code to make it happen to see if it was a flakey image. I added it without issue by creating the the viewDidLoad implementation below.

Note that you don't need this if Xcode / Interface Builder is working the way it should. Either user IB or use this code, not both :

- (void)viewDidLoad {UIColor *   theColor;UIImage *   theImage;[super viewDidLoad];// Do any additional setup after loading the view, typically from a nib.theImage = [UIImage imageNamed:@"/<redacted>/background sea green gradent.png"];theColor = [UIColor colorWithPatternImage: theImage ];[self.view setBackgroundColor: theColor ]; }

Note: This can be the same issue if your button is not showing a custom image...