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 1069451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:25:25+00:00 2026-05-16T20:25:25+00:00

So I have some animation blocks to create some very simple animations on my

  • 0

So I have some animation blocks to create some very simple animations on my app (eg. a wheel spinning continuously). This is the code for the animation (I have changed if from the old commitanimations style block but was getting the same problem with that).

[UIView animateWithDuration:30 delay:0.0
     options:(UIViewAnimationOptionAllowUserInteraction |
     UIViewAnimationOptionCurveLinear 
  |  UIViewAnimationOptionRepeat)
animations:^(void){
     wheel.transform = CGAffineTransformMakeRotation(M_PI*-0.5);
 }
completion:^(BOOL finished){
 if(finished){NSLog(@"^^^^^^^^wheel^^^^FINSIHED");
   ]}
}];

The problem I have is that on OS4 when the app has been dismissed to the multitasking bar and resumed the animation stops. If on resume I reset the position when the app becomes active again, like this….

wheel.transform = CGAffineTransformMakeRotation(0);

then it continues.

This isn’t ideal because my animation skips when it restarts. I don’t understand why this happens or why I should need to do this.

The “on finished” method gets called almost immediately as the animation starts which is odd as this animation should never finish. Also it DOES NOT get called when the app becomes active and the animation actually stops.

Anyone any ideas or suggestions? I’m been struggling with this for some time now…

  • 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-16T20:25:26+00:00Added an answer on May 16, 2026 at 8:25 pm

    The syntax of your code is invalid; your code will not compile as shown. A correct version would be:

        [UIView animateWithDuration:2 delay:0.0
                        options:(UIViewAnimationOptionAllowUserInteraction |
                                 UIViewAnimationOptionCurveLinear 
                                 |  UIViewAnimationOptionRepeat)
                     animations:^(void){
                         wheel.transform = CGAffineTransformMakeRotation(M_PI*-0.5);
                     }
                     completion:^(BOOL finished){
                         if(finished) NSLog(@"^^^^^^^^wheel^^^^FINSIHED");
                     }
         ];
    

    The reason why the “on finished” block is called when the app resumes after suspension and you set the animation going again is that the wheel’s transform is already at its final position (this is where you set it in your animations block). So, when the app resumes, you must first reset the wheel’s transform (I would do this by setting it to CGAffineTransformIdentity) and then set the animation going.

    A smarter approach would be to use CGAffineTransformRotate (and not CGAffineTransformMakeRotation). That way, you can set the transform based on what the transform is now, rather than setting it absolutely.

        [UIView animateWithDuration:2 delay:0.0
                        options:(UIViewAnimationOptionAllowUserInteraction |
                                 UIViewAnimationOptionCurveLinear 
                                 |  UIViewAnimationOptionRepeat)
                     animations:^(void){
                         wheel.transform = CGAffineTransformRotate(view.transform, (M_PI*-0.5));
                     }
                     completion:^(BOOL finished){
                         // whatever
                     }
        ];
    

    I presume that your wheel is symmetric with respect to your chosen angle, so the user will never see the difference, and the slip you’re complaining about (when you reset the transform) will be eliminated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code like this in a winforms app I was writing to
I have a storyboard(1) that does some basic animations in 2 seconds. I want
I have some code for starting a thread on the .NET CF 2.0: ThreadStart
I have some classes layed out like this class A { public virtual void
I have some C# / asp.net code I inherited which has a textbox which
I have some kind of test data and want to create a unit test
I have some UI in VB 2005 that looks great in XP Style, but
I have some ASP.NET web services which all share a common helper class they
We have some input data that sometimes appears with &nbsp characters on the end.
We have some files on our website that users of our software can download.

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.