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 trialJake Adam
9,226 PointsiOS Background image code challenge help
I dont understand what is wrong with my code here:
UIImage *background = [UIImage imageNamed: @"background"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:@"background"];
The question is asking to fix the previous code and set imageView to an object Image
1 Answer
aldoolivares
14,478 PointsIt simply means that you need to use the UIImage that you just created,like this:
UIImage *background = [UIImage imageNamed: @"background"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:background];
In your second like you were trying to pass a string (@"background"), but it needed your UIImage *background variable.
Cheers :D
Jake Adam
9,226 PointsThank you so much!
Ken Alger
Treehouse TeacherKen Alger
Treehouse TeacherEdited for markup.