nathanjosiah - 1 year ago 93

iOS Question

how do i calculate the angle of rotation for any given object (ie a uiimageview)?

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

Technically you can't, because the transform can include a *skew* operation which turns the image into a parallelogram and the rotation angle isn't defined anymore.

Anyway, since the rotation matrix generates

```
cos(x) sin(x) 0
-sin(x) cos(x) 0
0 0 1
```

You can recover the angle with

```
return atan2(transform.b, transform.a);
```

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**