Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

Crystal 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
Stone Preston
42,016 Points

Homer 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
Stone Preston
42,016 Points

go 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

I deleted the background, but when I ran it, the background was blank

Stone Preston
Stone Preston
42,016 Points

ok 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

ok, how would i go about sharing it on dropbox or github?

Stone Preston
Stone Preston
42,016 Points

dropbox is probably easiest. just create a dropbox account and upload your xcode project to that/

Stone Preston
Stone Preston
42,016 Points

sorry, can you upload the whole project folder, not just the .xcodeproj file.

Stone Preston
Stone Preston
42,016 Points

looks 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

Stone Preston
Stone Preston
42,016 Points

that link is not working for me. takes me to the home page

Stone Preston
Stone Preston
42,016 Points

thats still just the .xcodeproj file. I need the whole folder that that file is actually in.

dropbox will not let me upload the whole file, can i email it to you?

Stone Preston
Stone Preston
42,016 Points

Try compressing it. Try right clicking and then see if there is an option to zip it up or compress it

Stone Preston
Stone Preston
42,016 Points

yep thats exactly what I need thanks. Ill take a look and see if I can find anything

oh wow, thanks I really appreciate

also when you sign up for the developer account in iTunes, do I need to pay the full amount right away?

Stone Preston
Stone Preston
42,016 Points

Yes I don't think they do payment plans or anything like that. I think it's just a one time payment right then

ok thanks