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
nofx1717
5,096 PointsImage Based Animation (Code Challenge)
Having trouble on this one.
Assume you have images named 'Robot1.png','Robot2.png','Robot3.png','Robot4.png', create an array of UIImage objects called 'robotImages'.
UIImage *image = [UIImage imageNamed:@"robot.png"]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
/* Write your code below this line */
self.imageView.robotImages = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"Robot1.png"], [UIImage imageNamed:@"Robot2.png"], [UIImage imageNamed:@"Robot3.png"], [UIImage imageNamed:@"Robot4.png"], nil];
8 Answers
Nick Pettit
Treehouse TeacherHey Jesse,
I'm not sure what's going on here, but I'll ping Amit so that he can get back to you.
David Carson
9,400 PointsDo the challenge as if there was no property set... so your code would look like:
NSArray *robotImages = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"Robot1.png"], [UIImage imageNamed:@"Robot2.png"], [UIImage imageNamed:@"Robot3.png"], [UIImage imageNamed:@"Robot4.png"], nil];
Joseph Finkenbinder
5,340 PointsThe question; "Assume you have images named 'Robot1.png','Robot2.png','Robot3.png','Robot4.png', create an array of UIImage objects called 'robotImages'."
I tried your code above and couldn't get it to work.
Ernest Grzybowski
Treehouse Project ReviewerRalph Ritter III
Courses Plus Student 476 PointsAfternoon Folks,
I completed the first task to create the array of images however I'm stumped on the second task:
"Set the 'robotImages' to the animation images property of 'imageView'"
Can anyone help explain this task please?
Ralph Ritter III
Courses Plus Student 476 PointsNever mind I got it
Ernest Grzybowski
Treehouse Project ReviewerThis answer is for Ralph Ritter III
The second code challenge can be completed with:
The answer is pretty self explanatory since it is a short question/answer
imageView.animationImages = robotImages;
for anyone that comes across this down the road.
Ralph Ritter III
Courses Plus Student 476 Pointssorry, should have posted this with my response, thanks Ernest!
Trevor Gerzen
2,749 PointsI got stuck on this too as it was taught how to write an array that way with the predictionArray but for me that was a few days ago. It would be nice to have a bit more help early on as to why the challenges are done the way they are.
I get a bit frustrated with myself when I'm doing a challenge and its not working even though I did it just the way it was taught in the video I just watched, not calling to memory right away what was taught a couple videos previously.
Noah Gray
801 PointsThis still does not explain it to me.