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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:55:40+00:00 2026-05-30T06:55:40+00:00

How can I rotate an UIImageView 360 degrees using BLOCK-BASED animation? here is my

  • 0

How can I rotate an UIImageView 360 degrees using BLOCK-BASED animation?

here is my try, but it repeat 180 rotations instead of two consecutive animations

   void (^anim) (void) = ^{
         uiImgDisc.transform = CGAffineTransformMakeRotation(3.14159265);
    };

    void (^after) (BOOL) = ^(BOOL f){
        [UIView animateWithDuration:1
                              delay:0
                            options:UIViewAnimationCurveLinear
                         animations:^(void){
                             uiImgDisc.transform = CGAffineTransformMakeRotation(3.14159265);
                         }
                         completion:nil];

    };

    [UIView animateWithDuration:1
                          delay:0
                        options:UIViewAnimationCurveLinear | UIViewAnimationOptionRepeat
                     animations:anim
                     completion:after];
  • 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-30T06:55:42+00:00Added an answer on May 30, 2026 at 6:55 am

    It isn’t block based, but you might want to try using CAKeyFrameAnimation where you specify a few key frames that the animation needs to incorporate. The benefit versus the block based method is that the Core Animation method will allow more fluid animations.

    It may be a little overkill, because as Rob says, you can just do a CABasicAnimation and set the fromValue and toValue to 0 and 2*M_PI, respectively. But this example shows you how you could also do arbitrary rotation animations with fluid motion.

    First, make sure you add the QuartzCore Framework to your build phases. Then make sure you import the header using

    #import <QuartzCore/QuartzCore.h> 
    

    then in your rotation method, do this:

    CAKeyframeAnimation *theAnimation = [CAKeyframeAnimation animation];
    theAnimation.values = [NSArray arrayWithObjects:
                           [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0, 0,0,1)],
                           [NSValue valueWithCATransform3D:CATransform3DMakeRotation(3.13, 0,0,1)],
                           [NSValue valueWithCATransform3D:CATransform3DMakeRotation(6.26, 0,0,1)],
                           nil];
    theAnimation.cumulative = YES;
    theAnimation.duration = 1.0;
    theAnimation.repeatCount = 0;
    theAnimation.removedOnCompletion = YES;
    
    
    theAnimation.timingFunctions = [NSArray arrayWithObjects:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn], 
                                    [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                    nil
                                    ];
    
    [imageView.layer addAnimation:theAnimation forKey:@"transform"];
    

    inspired by the following: https://github.com/jonasschnelli/UIView-i7Rotate360

    Good Luck!

    t

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

Sidebar

Related Questions

I have an UIImageView which I can rotate using CABasicAnimation . That works fine.
I have a simple 3D cube that I can rotate using the following code:
How can I rotate an Bitmap a given number of degrees while maintaining the
I'm having trouble roating an image around itself using Canvas. Since you can't rotate
My problem is this - I have a UIImageView which a user can rotate
How can I rotate and translate a UIImageView off one side of the screen,
I must rotate an image but I can't use the gestures or the slider,
You can rotate embedded font but can not rotate device font. Why adobe allows
How can I get a UIImageView to rotate itself 90° counter-clockwise and have the
I am trying to change my Sprite anchor point so that I can rotate

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.