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

Animation code challenge question

So I did all the steps for the animation code challenge (with some forum help), but I'm still a little confused by one thing. Why is it necessary to specify in the second step that - imageView.animationImages = robotImages; but then not use robotImages again for the following steps? Is it because you need to explicitly state where the software should look for the array of images to animate?

1 Answer

I haven't done that challenge in months but I can explain something about animationImages. Understand that what you're doing is calling a property of the imageView. So you have an object called imageView and it happens to have this thing to describe it. A property of the object called animationImages. imageView.animationImages states that the images for animating this object are the thing on the right side of the equals sign. robotImages. Now what is robotImages? It's an array of pictures. After you set a duration and kick off the animation, imageView will flip through this array of robotImages like a flipbook and you get an animation. So there's no need to use that array again once you set the property animationImages to robotImages. Hope this helps.

Got it! Thanks - the way some of these properties and objects seem to refer back to each other is taking some getting used to.