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

  • Home
  • SEARCH
  • 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 5962429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:06:15+00:00 2026-05-22T19:06:15+00:00

Is there a reason why animations do not work in a loop? I know

  • 0

Is there a reason why animations do not work in a loop? I know you can do the command:

[UIView setAnimationRepeatCount: someNumber];

which was working fine until I put actual different pdfs to be loaded. So before, with just one pdf that would always get loaded, when I did the animation say 5 times to go to the last document, the animations would look correct. But now that I have 5 different pdfs, it will flip the page 5 times with the CurlUp but it will keep showing the 1st pdf in the list, and then at the end load the proper one. So I thought I could do it in a loop, keeping track of the location in the array, and load each pdf at each location as i flip through the pages so it gives the user the feeling of where they are in the stack of pdfs. But when I put the core animation code in a loop, it basically shows the animation once, but does get to the correct document.

  • 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-22T19:06:16+00:00Added an answer on May 22, 2026 at 7:06 pm

    From my understanding of what you’re doing, it sounds like you’re actually running all 5 animations at once. When you perform an animation block in a for-loop, the runloop doesn’t iterate between each loop and only the last animation gets run.

    What you’ll need to use is use completion calls and “chain” them together. So you run the first animation, then on that completion call you run the second, then on that call the third, etc. Much more lengthy to code, but this will work.

    Would be easier to use blocks in this scenario, then all your animation code will be in one place instead of having to spread it all across a bunch of methods for each animation. You would just nest the blocks, in the first animation’s completion block you’d spawn the second, then the third, etc.

    Here’s an example using the blocks method. It’s a little hard to read, but you’ll get the idea. You might be able to create a single animation block and reuse it in each completion method, but I don’t know all of the catches of doing that, and this is much easier to read when you’re first trying to understand it.

    Note that I haven’t actually tried this or tested it, but I think it will do what you want.

        [UIView animateWithDuration:1.0 animations:^(void) {
            // Animation changes go here
            // blah.alpha = 1.0
            // blah.position = CGPointMake
            // etc
        } completion:^(BOOL finished) {
            // Start next animation which will run with this one finishes
            [UIView animateWithDuration:1.0 animations:^(void) {
                // Animation changes go here
                // blah.alpha = 1.0
                // blah.position = CGPointMake
                // etc
            } completion:^(BOOL finished) {
                // Start next animation which will run with this one finishes
                [UIView animateWithDuration:1.0 animations:^(void) {
                    // Animation changes go here
                    // blah.alpha = 1.0
                    // blah.position = CGPointMake
                    // etc
                } completion:^(BOOL finished) {
                    // Start next animation which will run with this one finishes
                    [UIView animateWithDuration:1.0 animations:^(void) {
                        // Animation changes go here
                        // blah.alpha = 1.0
                        // blah.position = CGPointMake
                        // etc
                    } completion:nil];
                }];
            }];
        }];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any reason something like this would not work? This is the logic
Is there a reason why it can't work?? Here is a code sample :
Is there any reason not to use the bitwise operators &, |, and ^
Is there any reason not to set up the install so that major upgrade
Is there any reason why I should pick JSON over XML, or vice-versa if
Is there any reason to use a varchar field instead of a date field
Is there any reason to start a GUI program (application for Windows) written in
Is there a reason why most function definition in device driver in linux code
Is there any reason for the use of 'T' in generics? Is it some
Is there any reason to prefer a CharBuffer to a char[] in the following:

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.