Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

Mark McCuller
Mark McCuller
3,539 Points

Simple iPhone App (iOS7)

Build a Simple iPhone App (iOS7) / Animating and Intercepting Events / Image Based Animation / Code Challange:

I am stuck on this code challange and could you any help. Question 1 of 3 (Let's add animation to the Random Quotes app. A property named 'imageView' has been already defined. Assuming you have images named '01.png','02.png','03.png', create an array of UIImage objects and assign them to the 'animationImages' property of 'imageView'.) My code is:

self.imageView = [[randomQutoes alloc] init]; self.backgroundImageView.animationImage = [[NSArray alloc] initWithObjects: [UIImage imageNamed:@"01"], [UIImage imageNamed:@"02"], [UIImage imageNamed:@"03"], nil];

Thank you for the help, Mark

3 Answers

Hey Mark,

It's a simple mistake to make but you're error lies here:

self.backgroundImageView.animationImage

In the app that Treehouse is getting you to build, the name of your UIImageView is "backgroundImageView". In the code challenge, the name of your UIImageView is in fact "imageView". Change this and you should be good to go!

:)

Mark McCuller
Mark McCuller
3,539 Points

Steve,

I still am not passing part 1 of 3 in code challenge. I corrected code below from your comments. Thank you for the help.

Mark

Code: self.imageView = [[randomQutoes alloc] init]; self.imageView.animationImage = [[NSArray alloc] initWithObjects: [UIImage imageNamed:@"01"], [UIImage imageNamed:@"02"], [UIImage imageNamed:@"03"], nil];

Emmanuel Guerlesquin
Emmanuel Guerlesquin
3,536 Points

Hey Mark,

You might passed this challenge by now but this post hasn't been answered.

The mistake is in the name of the images: @"01" should be replaced by @"01.png" @"02" should be replaced by @"02.png" @"03" should be replaced by @"03.png"

Code:

self.imageView.animationImages = [[NSArray alloc] initWithObjects: 
[UIImage imageNamed:@"01.png"], 
[UIImage imageNamed:@"02.png"], 
[UIImage imageNamed:@"03.png"], nil];