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 trialHomer Denson
2,024 PointsCrystal Ball background not animating please help!
I believe I followed the video correctly, but my background is still not animating, everything else is running fine. Here is my code.
self.crystalBall = [[THCrystalBall alloc] init];
self.backgroundImageView.animationImages = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"CB0001"],[UIImage imageNamed:@"CB0002"], [UIImage imageNamed:@"CB0003"], [UIImage imageNamed:@"CB0004"], [UIImage imageNamed:@"CB0005"], [UIImage imageNamed:@"CB0006"], [UIImage imageNamed:@"CB0007"], [UIImage imageNamed:@"CB0008"], [UIImage imageNamed:@"CB0009"], [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];
self.backgroundImageView.animationDuration = 2.5f;
self.backgroundImageView.animationRepeatCount = 1;
///////
pragma mark - Prediction
-(void) makePrediction{ [self.backgroundImageView startAnimating];
12 Answers
Stone Preston
42,016 PointsHomer Denson I fixed your issue. there was a problem in your animation images array. you did not have the images numbered 1 - 10 named correctly it seems. replace the code where you add all the images to the array with
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];
before you had named images like this: [UIImage imageNamed:@"CB0001"]
which does not have enough zeros in the name
Stone Preston
42,016 Pointsgo to your storyboard and double check that you do not have an background imageView in your storyboard. you have created it it in code so if you have one on your storyboard as well it could be blocking the animation image view. if you have one on your storyboard, delete it
Homer Denson
2,024 PointsI deleted the background, but when I ran it, the background was blank
Stone Preston
42,016 Pointsok maybe you were supposed to have it added on your storyboard then. go ahead and add an imageView back on your storyboard and reconnect it to your header file. make sure you name it backgroundImageView. can you post your project on github or upload it to dropbox? ill take a closer look at it if you can do that
Homer Denson
2,024 Pointsok, how would i go about sharing it on dropbox or github?
Stone Preston
42,016 Pointsdropbox is probably easiest. just create a dropbox account and upload your xcode project to that/
Homer Denson
2,024 PointsStone Preston
42,016 Pointssorry, can you upload the whole project folder, not just the .xcodeproj file.
Homer Denson
2,024 PointsStone Preston
42,016 Pointslooks like you need to upload the folder thats one directory above that. upload the folder that contains that .xcproject file. so you probably have a folder named CrystalBall, and in that folder there is the xcproject file, along with the folder you uploaded above. I need the first CrystalBall folder that has the xcproject file and the other CrystalBall folder inside of that. sorry this is so much trouble
Homer Denson
2,024 PointsStone Preston
42,016 Pointsthat link is not working for me. takes me to the home page
Homer Denson
2,024 PointsStone Preston
42,016 Pointsthats still just the .xcodeproj file. I need the whole folder that that file is actually in.
Homer Denson
2,024 Pointsdropbox will not let me upload the whole file, can i email it to you?
Stone Preston
42,016 PointsTry compressing it. Try right clicking and then see if there is an option to zip it up or compress it
Homer Denson
2,024 Pointshopefully this works https://www.dropbox.com/s/9wf02myy45qq7jl/CrystalBall.zip
Stone Preston
42,016 Pointsyep thats exactly what I need thanks. Ill take a look and see if I can find anything
Homer Denson
2,024 Pointsoh wow, thanks I really appreciate
Homer Denson
2,024 Pointsalso when you sign up for the developer account in iTunes, do I need to pay the full amount right away?
Stone Preston
42,016 PointsYes I don't think they do payment plans or anything like that. I think it's just a one time payment right then
Homer Denson
2,024 Pointsok thanks