title: How to rotate UIImageView in 3d circular way?
body: <p>I m new to core animation i want to rotate an imageview left or right but i want it to be rotated in z axis so it can looks like a circular rotation.Here is an image for more explanation</p>
  
  <p><a href="https://i.stack.imgur.com/bfJMS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bfJMS.png" alt="alt text"></a>
  </p>
  
  <p>i want to rotate the image the inner imageview these are two imageview's.</p>
  
  <p>i have tried this code please someone apply this and correct the code.</p>
  
  <pre><code>-(void)Rotate
  {
  [UIView beginAnimations:nil context:NULL];
  [UIView setAnimationDuration:3.0];
  CATransform3D t1 = CATransform3DIdentity;
  if(goingCW)
  {
      t1 = CATransform3DRotate(t1, radians(90), 0, 1, 0);
      t1 = CATransform3DTranslate(t1, CUBESIZE/2, 0, 0);
      t1 = CATransform3DRotate(t1, radians(90), 0, 1, 0);
      t1 = CATransform3DTranslate(t1, CUBESIZE/2, 0, 0);
      t1 = CATransform3DRotate(t1, radians(90), 0, 1, 0);
      t1 = CATransform3DTranslate(t1, CUBESIZE/2, 0, 0);
      CATransform3D moveTransform = CATransform3DRotate(t1, 0.0, -1.0, 0.0, 0.0);
      [InnerView.layer setTransform:moveTransform]; 
      NSLog(@"Going Left");
  
  }
  else
  {
      NSLog(@"Going Right");
      t1 = CATransform3DRotate(t1, radians(90), 0, 1, 0);
      t1 = CATransform3DTranslate(t1, CUBESIZE, 0, 0);
      CATransform3D moveTransform = CATransform3DRotate(t1, 0.0, 1.0, 0.0, 0.0);
      [InnerView.layer setTransform:moveTransform]; 
  
  }
  goingCW=!goingCW;   
  [UIView commitAnimations];
  
  }
  </code></pre>
  
  <p>call this with a timer in viewDidLoad or in applicationDidFinishLaunching</p>
  
  <pre><code>goingCW = YES; // change this to NO to make it start rotating CCW instead A bool flag in header file.
      NSTimer *timer=[NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(Rotate) userInfo:nil repeats:YES];
  </code></pre>