旋转UIImageView 1度

时间:2015-04-23 09:44:35

标签: xcode swift uiimageview xcode6

我有旋转图像视图的代码:

func rotateAgain(){
    UIView.animateWithDuration(1.0,
        delay: 0.0,
        options: .CurveLinear,
        animations: {self.imageView.transform = CGAffineTransformRotate(self.imageView.transform, 1.degreesToRadians)},
        completion: {finished in if self.rotating { self.rotateOnce() }})
}

代码有什么问题?

1 个答案:

答案 0 :(得分:0)

CGAffineTransformRotate的第二个参数是角度,但它是以弧度为单位,如果你想将弧度变换为度数,你必须将角度乘以 0.0174532925

旋转240度的示例:

CGAffineTransformRotate(self.imageView.transform, 240 * 0.0174532925)