2010-07-02 87 views

回答

1

你只需要將字符串轉換爲數字。

CGAffineTransformMakeRotation([mytextfield.text floatValue]); 
+1

您可能需要度轉換爲弧度爲好。 – kennytm 2010-07-02 14:21:41

+1

也許他想要90弧度:) – 2010-07-02 14:24:49

+0

對不起90度..不是弧度... – 2010-07-02 14:41:12

1
#define DEGREES_TO_RADIANS(__ANGLE__) ((__ANGLE__)/180.0 * M_PI) 

-(IBAction)RotateButtonPressed:(id)sender; 
{ 
    [UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDuration:1.5]; 
    arrow.center = CGPointMake(151.0,80.0); 
arrow.transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS([degrees.text floatValue])); 
    [UIView commitAnimations]; 


} 

那我怎麼從弧度轉換爲度CGAffineTransformMakeRotation

對於任何人的將來參考