Get the current angle/rotation/radian for a UIView?

前端 未结 6 1318
傲寒
傲寒 2021-01-30 12:40

How do you get the current angle/rotation/radian a UIView has?

6条回答
  •  滥情空心
    2021-01-30 13:13

    For Swift 3, you could use the following code:

    let radians:Float = atan2f(Float(view.transform.b), Float(view.transform.a))
    let degrees:Float = radians * Float(180 / M_PI)
    

提交回复
热议问题