1
我试图让UIView
调用object
来旋转指向另一个UIView
的中心,调用orig
。我似乎无法正确计算角度。我的触发有点生疏,所以我无法弄清楚我的数学错误。旋转UIView指向另一个UIView
let y0 = object.center.y
let y1 = orig?.center.y
let x0 = object.center.x
let x1 = orig?.center.x
let angle = atan2((y1! - y0), (x1! - x0)) * 180/CGFloat.pi
rotateTo(object: object, degrees: angle, time: deplexed[1] as! CGFloat)