kalafun kalafun - 4 months ago 18
iOS Question

ios animation, rotating button, button suddenly changes position

I am trying to implement

in my
. I just want to try a simple rotation of a
. The button itself is
, but also it changes its position and the rotation angle is different than the one I want. I have also added the
autoresizesSubwievs = NO;

- (IBAction)rotateView:(id)sender
[UIView animateWithDuration:0.6f delay:0.1 options:UIViewAnimationOptionCurveEaseOut animations:^{
self.view.autoresizesSubviews = NO;
[self.buttoner setTransform:CGAffineTransformRotate(self.buttoner.transform, 90.0f)];
} completion:nil];

What am I doing wrong? Can you please help me?

I have two buttons, when the first gets pressed, I call the above method ... but this causes to move the first button and then to move the second button and rotate it with inappropriate angle. I dont understand that at all..


For the angle problem, Instead of passing 90, you should pass the radian value of the angle which is M_PI/2 .

[self.buttoner setTransform:CGAffineTransformRotate(self.buttoner.transform, M_PI/2)];