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

iOS

Set the 'robotImages' to the animation images property of 'imageView'

Good Evening 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? Thanks!

11 Answers

never mind, I came back to it, realized what it was asking me and completed the task.

In case anyone else needs this and gets stuck:

imageView.animationImages = robotImages;

Glad you caught it ;)

Thanks I was getting hung up on this too. I was prefixing the imageView with self. and it doesn't like that, not sure exactly why. Should have remembered as I ran into the same thing in an earlier code challenge

Jordan Halvorsen
Jordan Halvorsen
3,868 Points

Yeahhhh your hints need to improve a bit with these code sections Ryan. The second task got me a bit pissed off as well. Came back to it 6 times... no bueno. Wasted over an hour. That's a good way to encourage people to never come back. I would recommend adding a single use "Show me how it's done!" cheat on each badge if you expect people to write code that isn't explicitly showcased in the video.

I am having issues on the first task. Here is my code. I think it is something simple that I am missing.

UIImage *image = [UIImage imageNamed:@"robot.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

/* Write your code below this line */
robotImages = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"Robot1.png"],[UIImage imageNamed:@"Robot2.png"],[UIImage imageNamed:@"Robot3.png"],[UIImage imageNamed:@"Robot4.png"], nil];

Any ideas?

Figured it out.

NSArray* robotImages;
robotImages = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"Robot1.png"],[UIImage imageNamed:@"Robot2.png"],[UIImage imageNamed:@"Robot3.png"],[UIImage imageNamed:@"Robot4.png"], nil];
James Barnett
James Barnett
39,199 Points

@Jordan - I've spent many an hour chasing my own tail while troubleshooting. Liking coding is largely about enjoying spending the better part of a day hunting for a misplaced semicolon.

In regards to "wast[ing] over an hour", I've learned a lot of valuable information from doing something wrong and learning how to fix it.

Parsing directions, spotting errors in the instructions as well as typos in your own code are all valuable real-world skills I use every day. As is puzzling out how something is currently setup when you have no documentation telling you how things are supposed to work.

R. Cody Tolmasoff
PLUS
R. Cody Tolmasoff
Courses Plus Student 3,134 Points

I got a bit frustrated with the step 2/4 on this exercise. I had added an extra empty line between the NSArray robotImages and imageView.animationImages = robotImages; This would reflect my normal coding style. I wasn't able to get past this problem until I removed the extra blank line here and it was a bit frustrating since there was nothing wrong with the code.

I know it's hard to check for all of these variations in coding style, but I got stuck here for a good while for just having a blank line.

Ok, I don't think you should blame anyone but yourself for not catching stupid mistakes, however, I'm with Mario Rodriguez on this one. Why is it not self.imageView.animationImages?

It's a property!

Agree that the hints need to be clearer. Often skip to trying to code the later tasks for the first task. Text editor doesn't really help with typos either.