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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:56:45+00:00 2026-06-11T19:56:45+00:00

I have a speedometer widget I have created in my app using custom animation

  • 0

I have a speedometer widget I have created in my app using custom animation and I am having problems getting it to animate the way I want.

The pick animates to a particular point depending on a value that has been passed in. It ranges from 0 – 50. So if its at 50, the pick will rotate around all the way to the right, it will remain to the left hand side. I want however, at the start for the pick to always animate all the way to the right, then back down to its correct position. This is the part I am having problems with.

For time being I have hard coded all the values just for testing purposes.

The pick is in the centre at the start, so I need make it appear rotated to the left.

image.transform = CGAffineTransformRotate(image.transform, -0.8);

Then I need to animate it to the far right so I use this

 [UIView animateWithDuration:2.0 delay:0 options:UIViewAnimationOptionBeginFromCurrentState
                     animations:^{

                         image.transform = CGAffineTransformRotate(image.transform, 1.7);


                     }
                     completion:nil]; 

This works fine, so when the app starts, the pick will start from the left, then rotate all the way to the right.

The problem comes when I add this final part in

I then need it to rotate from the right back to the point where it needs to be. For time being I have set this to the centre.

 [UIView animateWithDuration:2.0 delay:2.0 options:UIViewAnimationOptionBeginFromCurrentState
                     animations:^{

                         image.transform = CGAffineTransformRotate(image.transform, -0.8);


                     }
                     completion:nil];

When the app starts, the pick starts off at the right hand side, then rotates to the centre. It is ignoring the first part where it should be starting off rotated to the left.

Does anyone know why this happens? Been at this for ages now and can’t seem to figure it out.

Edit: I tried sticking the final animation inside this code here

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 2.0 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{

        });

The pick will animate from left to right, but then it just jumps from the right to the centre point, rather than animating to the centre point :@

Tried this:

-(void) animateToEnd : (UIImageView *)image
{

    [UIView animateWithDuration:2.0 delay:0 options:UIViewAnimationOptionBeginFromCurrentState
                     animations:^{

                         image.transform = CGAffineTransformRotate(image.transform, 1.7);
                         image.transform = CGAffineTransformIdentity;


                     }
                     completion:nil];
}
-(void) animateToFinalPosition : (UIImageView *)image
{

    [UIView animateWithDuration:2.0 delay:2.0 options:UIViewAnimationOptionBeginFromCurrentState
                     animations:^{


                         image.transform = CGAffineTransformRotate(image.transform, -0.8);
               image.transform = CGAffineTransformIdentity;

                     }
                     completion:nil];
}


-(void) speedometer : (UIImageView *)image
{
    image.transform = CGAffineTransformRotate(image_p.transform, -0.8);




   [self animateToEnd:image];
   [self animateToFinalPosition:image];


}

It is ignoring the left to right animation, and just starts from the very left

Fixed problem. Changed the animation to this

-(void) animateToEnd : (UIImageView *)image_p
{

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:2.0];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    image_p.transform = CGAffineTransformRotate(image_p.transform, 1.7);

    [UIView commitAnimations];


}
-(void) animateToPosition : (UIImageView *)image_p : (float)temp
{

        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 2.0 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{

            NSLog(@"Dispatch");
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:2.0];
            [UIView setAnimationDelay:0.0];
            [UIView setAnimationDelegate:self];
            [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

            image_p.transform = CGAffineTransformRotate(image_p.transform, -temp);

            [UIView commitAnimations];
        });

}

That block code I was using before seem to be causing the issue

  • 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-06-11T19:56:47+00:00Added an answer on June 11, 2026 at 7:56 pm

    Do you reset your identitymatrix before applying another rotation:

    image.transform = CGAffineTransformIdentity;
    

    If it´s not reset then each rotation is applied on top of the previous one. This may be a part of your problem.

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

Sidebar

Related Questions

I have one speedometer app, in which 2 features are enabled by adding them
I have created a User Control using graphic's fill property. It's a circle. It's
I have a custom view that looks a little like a speedometer. <?xml version=1.0
i have a big problem. i try to implement a kind of speedometer. i
I have 2 websites, both with the same code which display a Jquery speedometer.
Have a rather abstract question for you all. I'm looking at getting involved in
I have been trying to make a layout for an Android app that functions
Have finally got a responsive site working (of a fashion). What I want to
have been trying couple of hours now to make my iphone app universal. The
Have some code: using (var ctx = new testDataContext()) { var options = new

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.