Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6054821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:11:46+00:00 2026-05-23T08:11:46+00:00

I currently have this method buttonHit that calls playAnimationToNumber which accepts an int, which

  • 0

I currently have this method buttonHit that calls playAnimationToNumber which accepts an int, which is then in turn used to run through a loop playing an array of images for each iteration, however it only seems to be playing the last array.. can you see why? because I am slightly lost and would appreciate the help.

//attached to button and it calls animation method.
- (void)buttonHit:(id)sender{
    [self playAnimationToNumber:5];
}



- (void)playAnimationToNumber:(int)number{

    for (int counter=1; counter<=number; counter++) {

        NSString *imageNameForFirstNumber = [NSString stringWithFormat:@"Flap%i.png", counter];
        NSArray *imagesForAnimation = [NSArray arrayWithObjects:[UIImage imageNamed:@"FlapMoving1.png"], [UIImage imageNamed:@"FlapMoving2.png"], [UIImage imageNamed:imageNameForFirstNumber], nil];


        animationArray.animationImages = [[NSArray alloc] initWithArray:imagesForAnimation];        

        animationArray.animationDuration = 0.5;
        animationArray.animationRepeatCount = 1;
        [animationArray startAnimating];
        [self.view addSubview:animationArray];



    }


    [animationArray release];
}

WORKING CODE
‘
– (void)playAnimationToNumber:(int)number{

NSMutableArray *imagesForAnimation = [[NSMutableArray alloc] initWithCapacity:0];


for (int counter=1; counter<=number; counter++) {

    NSString *imageNameForFirstNumber = [NSString stringWithFormat:@"Flap%i.png", counter];
    [imagesForAnimation addObject:[UIImage imageNamed:@"FlapMoving1.png"]];
    [imagesForAnimation addObject:[UIImage imageNamed:@"FlapMoving2.png"]];
    [imagesForAnimation addObject:[UIImage imageNamed:imageNameForFirstNumber]];
}
animationArray.animationImages = [NSArray arrayWithArray:imagesForAnimation];        

animationArray.animationDuration = 5.9;
animationArray.animationRepeatCount = 1;
[animationArray startAnimating];
[self.view addSubview:animationArray];
[imagesForAnimation release];   

}’

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:11:46+00:00Added an answer on May 23, 2026 at 8:11 am

    Here you go try this code.

       - (void)playAnimationToNumber:(int)number{
    
        NSMutableArray *imagesForAnimation = [[[NSMutable alloc] initWithCapacity:0] autoRelease];
        [imagesForAnimation addObject:[UIImage imageNamed:@"FlapMoving1.png"]];
        [imagesForAnimation addObject:[UIImage imageNamed:@"FlapMoving2.png"]];
    
            for (int counter=1; counter<=number; counter++) {
    
                NSString *imageNameForFirstNumber = [NSString stringWithFormat:@"Flap%i.png", counter];
                [imagesForAnimation addObject:[UIImage imageNamed:imageNameForFirstNumber]];
        }
                animationArray.animationImages = [NSArray arrayWithArray:imagesForAnimation];        
    
                animationArray.animationDuration = 0.5;
                animationArray.animationRepeatCount = 1;
                [animationArray startAnimating];
                [self.view addSubview:animationArray];
    
    
    
            }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently i have this method: static boolean checkDecimalPlaces(double d, int decimalPlaces){ if (d==0) return
I have this command that I run every 24 hours currently. find /var/www/html/audio -daystart
I have this method that I'm currently putting in each page I make, I
I currently have this: #define THIS(T) (boost::static_pointer_cast<T>(shared_from_this())) The macro is used in a method
I have this method called LoadToDictionary. It accepts a dictionary and a filepath. Currently,
I currently have this working but it requires me to have a static method
I currently have this code: /// <summary> /// This is an ineffecient method of
I currently have this in my code tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(updateLeftLabel:)]; which
We have a WebService with a method to upload images, this method accepts a
Currently, I have this method to compare two numbers Private Function ETForGreaterThan(ByVal query As

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.