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 Build a Simple iPhone App (iOS7) Animating and Intercepting Events Image Based Animation

I need help with this question

The first part of this assignment requires imageView as an assigned property that has three images in an array for an animation: So I enter my code as follows:

self.imageView.animationImages = [[NSArray alloc] initWithObjects:

[UIImage imagenamed:@"01png"], [UIImage imagenamed:@"02png"], [UIImage imagenamed:@"03png"], nil];

the editor keeps giving me the same error (that I am incorrectly assigning the property).

What am I doing wrong?

2 Answers

Stone Preston
Stone Preston
42,016 Points
self.imageView.animationImages = [[NSArray alloc] initWithObjects:

//imagenamed needs to be imageNamed and you are missing the . in 01.png etc
[UIImage imagenamed:@"01png"], [UIImage imagenamed:@"02png"], [UIImage imagenamed:@"03png"], nil];

the issue with the above code is that you need to capitalize the n in imageNamed and also you forgot the . in your file extensions

 self.imageView.animationImages = [[NSArray alloc] initWithObjects:

  [UIImage imageNamed:@"01.png"], [UIImage imageNamed:@"02.png"], [UIImage imageNamed:@"03.png"], nil];

LOL, Thank you!