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
Tricia Martin
19,604 PointsProgramming a Background Image
When I run the simulator the background image only shows up in the corner of the app, and not full screen.
This is the code I have:
- (void)viewDidLoad
{
[super viewDidLoad];
self.crystalBall = [[TMCrystalBall alloc] init];
UIImage *backgroundImage = [UIImage imageNamed:@"background"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:backgroundImage];
[self.view insertSubview:imageView atIndex:0];
}
3 Answers
Amit Bijlani
Treehouse Guest TeacherIs this a custom image of your own or is it the one provided by us? You might also want to make sure you have included both the standard and retina versions of the image.
Carlos (Charlie) Salazar
2,845 PointsHi Amit. I'm having the same problem as well. Here is a link to my entire project. Any thoughts.
BTW, this is a great class! Thanks again.
Amit Bijlani
Treehouse Guest TeacherJust downloaded and ran your project and it worked fine for me. You could try cleaning your project. From the menu select Product -> Clean or Shift+Command+K
Carlos (Charlie) Salazar
2,845 PointsThat worked! Thanks Amit!
Tricia Martin
19,604 PointsTricia Martin
19,604 PointsThey were the images downloaded from the program files. I put both the regular, and the retina one in the Images.xcassets folder. It works perfectly if I do it from Main.storyboard, but not if I code it in.
Amit Bijlani
Treehouse Guest TeacherAmit Bijlani
Treehouse Guest TeacherThat is strange can you share your entire project via DropBox or GitHub?
Tricia Martin
19,604 PointsTricia Martin
19,604 PointsI ended up adding it via the main.storyboard, and finishing the project. I'm not sure if I can re-create the problem or not.