如何将值从uitextfield传递给CGAffineTransformMakeRotation

时间:2010-07-02 14:17:17

标签: iphone core-graphics quartz-graphics

CGAffineTransformMakeRotation(90);

如何将mytextfield.text发送到CGAffineTransformMakeRotation 喜欢:CGAffineTransformMakeRotation(mytextfield.text);

2 个答案:

答案 0 :(得分:1)

您只需将字符串转换为数字即可。

CGAffineTransformMakeRotation([mytextfield.text floatValue]);

答案 1 :(得分: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的度数

任何人未来的参考