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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:28:50+00:00 2026-06-07T12:28:50+00:00

I was to able to move or animate my UIView by this code down

  • 0

I was to able to move or animate my UIView by this code down here:

- (void) makeAnim1{

    //downward animation 
    [UIView animateWithDuration:1.5
                          delay:0.15
                        options: UIViewAnimationCurveLinear
                     animations:^{
                         carousel.frame = CGRectOffset(carousel.frame, 0, 650);
                     }
                     completion:^(BOOL finished){ //task after an animation ends
                         [self performSelector:@selector(makeAnim1_1) withObject:nil afterDelay:2.0];
                         NSLog(@"Done!");
                     }];    
}

- (void) makeAnim1_1{

    //upward animation
    [UIView animateWithDuration:1.5
                          delay:0.1
                        options: UIViewAnimationCurveLinear
                     animations:^{
                         carousel.frame = CGRectOffset(carousel.frame, 0, -650);
                     } 
                     completion:^(BOOL finished){
                        NSLog(@"Done!");
                     }];    


} 

But it only move the UIView up and down. How can I make it spin like a Slot machine but only contains one image or view. Like rotate in z axis. But make it look like it contains more than one image.

Thanks for the help.

  • 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-07T12:28:51+00:00Added an answer on June 7, 2026 at 12:28 pm

    Instead of changing the frame inside the animation block you change the transform. The transform can be used to scale, rotate and translate (move) the view. You can only rotate around the z-axis but that is what you asked for. The transform property on the view takes a CGAffineTransform, like this:

    // rotate pi/2 degrees clockwise
    carousel.transform = CGAffineTransformMakeRotation(M_PI_2);
    

    If you need to do more advanced transforms like rotating around another axis then you would need to use a little bit of Core Animation and to set the transform property of the views layer (which takes a CATransform3D instead of a CGAffineTransform).

    As with all Core Animation code you need to import QuartzCore.framework and include QuartzCore/QuartzCore.h in your code.

    The above animations you are doing is UIView animations which are only meant to animate views but the animation you are asking for requires more advanced animations of the views layer. I suggest that you look at the documentation for CABasicAnimation and also take a look at the Core Animation Programming Guide for iOS to learn more.

    You can animate the x rotation of a views layer like this:

    CABasicAnimation *slotAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.x"];
    [slotAnimation setToValue:[NSNumber numberWithFloat:M_PI_2]];
    // animation customizations like duration and timing 
    // that you can read about in the documentation 
    [[carousel layer] addAnimation:slotAnimation forKey:@"mySlotAnimation"];
    

    The above code will indeed rotate the view around the x axis but will look very silly without perspective (search SO for “perspective Core Animation”, it has been asked about before). There is probably a lot of tweaking to get the correct look but this should be enough to get you started.

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

Sidebar

Related Questions

I want to be able to move the google analytics code into that database.
I need to be able to move the mouse around while I am handling
I want to detect application name which is able to move into SD card
I'm recently tried to make a custom tabcontrol that able to move the tab
I'm writing a simulation in which a creature object should be able to move
I've read about the svn move command but haven't been able to use it
not able to get this, can someone help for this LINQ query? select col1,
I'm re-factoring my code and would like to move a whole bunch of UILabels
I would like to be able to move a subview on and off the
I want to be able to move a particle in a straight line within

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.