I am trying to rotate buttons, that are shaped as a square (65 x 65). After I rotate them, the buttons change their sizes. Is there any way, to make a rotation and keep the size?
Code:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
self.stealthButton.transform = CGAffineTransformMakeRotation(radians);
self.recButton.transform = CGAffineTransformMakeRotation(radians);
self.toggleButton.transform = CGAffineTransformMakeRotation(radians);
[UIView commitAnimations];
try like this may be it helps you ,
CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotation.fromValue = [NSNumber numberWithFloat:0];
fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
fullRotation.duration = 1;
fullRotation.repeatCount = 1;
[button.layer addAnimation:fullRotation forKey:@"360"];
Add below framework in your project.
#import <QuartzCore/QuartzCore.h>
#import "QuartzCore/CALayer.h"