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
marsela meco
511 Pointsapp backgrounds
how do i set a image as a background after i have connected all buttons on view controller, like programmatically or no, how do set an image in Xcode iOS app. thanks
2 Answers
Stu Cowley
26,287 PointsHey Marsela,
I hope this is what you meant...
THViewController.m
-(Void)viewDidLoad{
[super viewDidLoad];
self.crystalBall = [[THCrystalBall alloc] init];
UIImage*backgroundImage = [UIImage imageNamed:@"background"];
UIImageView *imageView = [[UIImage alloc] initWithImage:backgroundImage];
[self.view insertSubview:imageView atIndex:0];
}
Hopefully this is what you were after
Stu :)
James Carney
16,255 PointsYou can also do it from the storyboard. Just make sure you change the hierarchy so that it is on the bottom and doesn't cover up your labels and buttons.