ios - Rotate UIButton and preserve its size -


i trying rotate buttons, shaped square (65 x 65). after rotate them, buttons change sizes. there way, make rotation , keep 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 may helps ,

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 project.

#import <quartzcore/quartzcore.h> #import "quartzcore/calayer.h" 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -