【发布时间】:2018-12-03 19:25:16
【问题描述】:
我不知道我在这段代码中做错了什么:
func findDegree() -> Double {
let xValue = directionstick.center.x - 35
let yValue = directionstick.center.y + 20
let newX = xValue*xValue
let newY = yValue*yValue
let hypo = (newX+newY).squareRoot()
return (xValue/hypo)
}
此代码用于查找旋转量。
【问题讨论】:
-
您好,欢迎来到 SO!你的问题有点不清楚。你能提供更多的上下文,最好是更多的代码吗?旋转什么?和什么有关?
directionstick是什么?最好有一个具有可重复结果的完整示例。 -
真的应该是可以旋转任何东西的代码。例如 rect.rotate(FindDegree())
标签: ios ipad swift-playground