1

I'm rotating an UIView along the x axis using CATransform3DMakeRotation using the below code:

  float radians = DegreesToRadians(30);
    [UIView animateWithDuration:0.15 animations:^{  
        self.moveControlView.layer.transform = CATransform3DMakeRotation(radians,1,0,0);
    }];

The rotation is applied always in the same versus (clockwise). I want to rotate the UIView in the opposite versus. In order to achieve my goal I've tried:

  • Set a negative angle (-30)
  • Set the angle to 330

But the versus of the orientation doesn't change.

I have also try to set x = -1 leaving the angle positive.

Any suggestion?

Alex Andrews
  • 1,498
  • 2
  • 19
  • 33
chiarotto.alessandro
  • 1,491
  • 1
  • 13
  • 31

1 Answers1

1

You should apply a perspective to your transform, as it's explained in the similar question:

CATransform3D perspectiveTransform = CATransform3DIdentity;
perspectiveTransform.m34 = 1.0 / -500;

self.moveControlView.layer.transform = 
CATransform3DRotate(perspectiveTransform, radians, 1.0f, 0.0f, 0.0f);;
Community
  • 1
  • 1