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!
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
Mark McCuller
3,539 PointsImage Based Animation Code Challenge/ IOS7 /Simple iPhone APP
I can't get past task 1 of 3 in this code challenge. The question: "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'." Thanks for the help. My code is:
self.imageView = [[randomQuotes alloc] init];
self.imageView.animationImages = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"01.png"], [UIImage imageNamed:@"02.png"],
[UIImage imageNamed:@"03.png"], nil];
6 Answers

Rashii Henry
16,433 Pointswell, the questions states that you should Create an array of UIImage objects and assign them to the 'animationImages' property of 'ImageView'.
However, the first part of your code is completely unnecessary. it doesn't contribute to what the question is asking for. Oh yeah, and just trying to copy exactly what you saw in the video won't work. so your code should be:
self.imageView.animationImages = [[NSArray alloc] initWithObjects: [UIImage imageNamed:@"01.png"], [UIImage imageNamed:@"02.png"], [UIImage imageNamed:@"03.png"], nil];

Simon Sunde
1,639 PointsI'm totally lost now. i'm also at the last challange but i cant find my error ??
This is my code:
import "THViewController.h"
@implementation THViewController
-
(void)viewDidLoad { [super viewDidLoad];
// backgroundImage is a local variable UIImage *backgroundImage = [UIImage imageNamed:@"background"]; // imageView is a property self.imageView = [[UIImageView alloc] initWithImage:backgroundImage];
// Add your code below! // Remember 'imageView' is a property // so refer to it as 'self.imageView'
self.imageView.animationImages = [[NSArray alloc] initWithObjects: [UIImage imageNamed:@"01.png"], [UIImage imageNamed:@"02.png"], [UIImage imageNamed:@"03.png"], nil]; self.imageView.animationDuration = 5.0f;
}
- (void) imageView { [self.imageView startAnimation]; }
@end

Patrick Czapla
1,442 PointsI have the same issue.

Mark McCuller
3,539 PointsRashii,
Thank you very much for your excellent assistance.
-Mark

Rashii Henry
16,433 Pointsno problem man!

David Langley
10,965 PointsHey Rashii,
sorry to jump in here, I have exactly the code that you have above as the answer but my problem is i dont know if i should be replacing the code there already or adding to it, and if i am adding to it, which line ?
seems like a crazy question i know but thats probably what i am struggling with the most on my coding journey so far (only 3 weeks), that is the order the code needs to sit. does this have to do with the order we want it to load and/or the life cycle ?
appreciate your help.

Rashii Henry
16,433 PointsI completely apologize for this late post, somehow i didn't get the notification.
but you should be adding the code above to the area underneath in the code challenge where it says add code below.

Shankar Narayan
9,099 Pointsnot working!!!
Hi David, same here, i tried the exact same code as Rashil but its not working, originally i had omitted the .png extension but after seeing Rashid's code i added it, but it still doesn't work!

GRAYSON D SMITH
1,547 PointsCheck your caps. Everything is case sensitive

Tom C
1,711 Pointsthe following worked for me...
self.imageView.animationImages = [[NSArray alloc] initWithObjects: [UIImage imageNamed: @"01"], [UIImage imageNamed: @"02"], [UIImage imageNamed: @"03"], nil];