如何计算饼图顶部的旋转角度?

时间:2017-01-16 08:20:19

标签: ios swift rotation transform pie-chart

当用户选择切片并让切片停在方向盘顶部时,我正在尝试旋转饼图轮

    // start from the middle of the slice angle
    let startAngle = self.slicesArray[index].angle / 2
    // end at top of chart
    let endAngle = //?
    let angleDifference = //?
    UIView.animateWithDuration(0.4, animations: {
        self.transform = CGAffineTransformRotate(self.transform, -angleDifference)
    })

enter image description here

1 个答案:

答案 0 :(得分:0)

你为endAngle尝试了3/2π吗?差异显然是endAngle - startAngle