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 trialKai Jackson
2,499 PointsXcode Error - Image Based Animation
i have added all of the images to create the animation have ever when implement the code in Xcode i get an error saying 'Too many arguments to method call, expected 1, have 60' . My code is as followed self.backgroundImageView.animationImages = [[NSArray alloc] initWithObjects: [UIImage imageNamed:@"CB00001", [UIImage imageNamed:@"CB00002", [UIImage imageNamed:@"CB00003"],
it goes all the way to CB000060
any help is appreciated
7 Answers
Holger Liesegang
50,595 PointsIt sounds like there is still something wrong with your animationImages NSArray. Try Copy&Paste the following:
self.backgroundImageView.animationImages = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"CB00001"],
[UIImage imageNamed:@"CB00003"],
[UIImage imageNamed:@"CB00004"],
[UIImage imageNamed:@"CB00005"],
[UIImage imageNamed:@"CB00006"],
[UIImage imageNamed:@"CB00007"],
[UIImage imageNamed:@"CB00008"],
[UIImage imageNamed:@"CB00009"],
[UIImage imageNamed:@"CB00010"],
[UIImage imageNamed:@"CB00011"],
[UIImage imageNamed:@"CB00012"],
[UIImage imageNamed:@"CB00013"],
[UIImage imageNamed:@"CB00014"],
[UIImage imageNamed:@"CB00015"],
[UIImage imageNamed:@"CB00016"],
[UIImage imageNamed:@"CB00017"],
[UIImage imageNamed:@"CB00018"],
[UIImage imageNamed:@"CB00019"],
[UIImage imageNamed:@"CB00020"],
[UIImage imageNamed:@"CB00021"],
[UIImage imageNamed:@"CB00022"],
[UIImage imageNamed:@"CB00023"],
[UIImage imageNamed:@"CB00024"],
[UIImage imageNamed:@"CB00025"],
[UIImage imageNamed:@"CB00026"],
[UIImage imageNamed:@"CB00027"],
[UIImage imageNamed:@"CB00028"],
[UIImage imageNamed:@"CB00029"],
[UIImage imageNamed:@"CB00030"],
[UIImage imageNamed:@"CB00031"],
[UIImage imageNamed:@"CB00032"],
[UIImage imageNamed:@"CB00033"],
[UIImage imageNamed:@"CB00034"],
[UIImage imageNamed:@"CB00035"],
[UIImage imageNamed:@"CB00036"],
[UIImage imageNamed:@"CB00037"],
[UIImage imageNamed:@"CB00038"],
[UIImage imageNamed:@"CB00039"],
[UIImage imageNamed:@"CB00040"],
[UIImage imageNamed:@"CB00041"],
[UIImage imageNamed:@"CB00042"],
[UIImage imageNamed:@"CB00043"],
[UIImage imageNamed:@"CB00044"],
[UIImage imageNamed:@"CB00045"],
[UIImage imageNamed:@"CB00046"],
[UIImage imageNamed:@"CB00047"],
[UIImage imageNamed:@"CB00048"],
[UIImage imageNamed:@"CB00049"],
[UIImage imageNamed:@"CB00050"],
[UIImage imageNamed:@"CB00051"],
[UIImage imageNamed:@"CB00052"],
[UIImage imageNamed:@"CB00053"],
[UIImage imageNamed:@"CB00054"],
[UIImage imageNamed:@"CB00055"],
[UIImage imageNamed:@"CB00056"],
[UIImage imageNamed:@"CB00057"],
[UIImage imageNamed:@"CB00058"],
[UIImage imageNamed:@"CB00059"],
[UIImage imageNamed:@"CB00060"],nil];
Holger Liesegang
50,595 PointsHi Kai,
there are some missing closing square brackets:
self.backgroundImageView.animationImages = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"CB00001"],
[UIImage imageNamed:@"CB00003"],
[UIImage imageNamed:@"CB00004"],
[UIImage imageNamed:@"CB00005"],
...
[UIImage imageNamed:@"CB00060"],nil];
Kind Regards Holger
Stone Preston
42,016 Points initWithObjects: [UIImage imageNamed:@"CB00001", [UIImage imageNamed:@"CB00002", [UIImage imageNamed:@"CB00003"],
you are missing closing brackets at the end of your first two calls to [UIImage imageNamed:] it needs to look like:
initWithObjects: [UIImage imageNamed:@"CB00001"], [UIImage imageNamed:@"CB00002"], [UIImage imageNamed:@"CB00003"],
Holger Liesegang
50,595 PointsIt looks like you've set a breakpoint by mistake. Press CMD+7 to select all breakpoints in Xcode. In the breakpoint navigator on the left you can now select and delete your breakpoints with backspace. Alternatively if you see one of these (blue) breakpoints in the gutter you can simply drag it away for deletion.
Kai Jackson
2,499 PointsThanks guys it has fixed the errors however when i try to run my app it says 'Thread 1:breakpoint 1.1' the line...self.backgroundImageView.animationDuration = 2.5f; is highlighted with a green line?
Kai Jackson
2,499 Pointsthanks it has solved that problem and now it runs! when i run the application the animation goes up but then skips a few frames and goes back to the starting frame? (sorry! I'm not very good at this)
Kai Jackson
2,499 PointsThanks so much! means a lot