Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Stone Preston
Stone Preston
42,016 Points

Retina Background Image not being displayed

Im doing the implementing designs for iPhone project and for some reason my background images arent displaying on the retina 4" sim. Ben Jakuben ran into some issues in the video, and I did what he did to fix them, however mine still are not appearing.

in my loginViewController in the viewDidLoad method I have

if([UIScreen mainScreen].bounds.size.height == 568) {

        self.backgroundImageView.image = [UIImage imageNamed:@"loginBackground-568h"];
    }

I have the same in my signup view controller. The background is just white whenever I run the sim, and it works whenever I use the 3.5" sim instead of 4".

Anyone have any issues with this as well?

Rashad Abdul-Salaam
Rashad Abdul-Salaam
Courses Plus Student 13,392 Points

I had the exact same issue, and as you mentioned in your comment, adding the loginBackground image to a separate "Images" folder within the directory tree resolved it for me.

Strange.

2 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

You could do a few things:

  1. Add an NSLog statement inside the if statement to ensure that the code inside is being executed.
  2. Make sure that you have an image named "loginBackground-568h" in your project.
  3. You might try adding that code to the viewDidAppear method.
Stone Preston
Stone Preston
42,016 Points

thanks for the suggestions, Ill try them out

Stone Preston
Stone Preston
42,016 Points

ok it has something to do with the asset catalog. I removed the image from the catalog and placed it in an images file in my project and it displayed the image fine. Gonna try readding the image to the catalog and see if it works

Stone Preston
Stone Preston
42,016 Points

it worked! thanks for the tips

Bradley White
Bradley White
21,285 Points

Im having the same problem. I deleted the image assets folder, downloaded the project files, copied to my project and it still won't show the loginBackground. Ive tried cleaning the build and watched the video 3 times to make sure I wasn't missing anything. NSLog(@"What Gives!!!!!");

The only thing I can do to make it work is remove the -568h from loginBackground in the code. Is it because I built the app from scratch using Xcode 5 with iOS7?

Bradley White
Bradley White
21,285 Points

Im having the same problem. I deleted the image assets folder, downloaded the project files, copied to my project and it still won't show the loginBackground. Ive tried cleaning the build and watched the video 3 times to make sure I wasn't missing anything. NSLog(@"What Gives!!!!!");

The only thing I can do to make it work is remove the -568h from loginBackground in the code. Is it because I built the app from scratch using Xcode 5 with iOS7?