Returns an affine transformation matrix constructed from a rotation value you provide.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
- Core Graphics
The angle, in radians, by which this matrix rotates the coordinate system axes. In iOS, a positive value specifies counterclockwise rotation and a negative value specifies clockwise rotation. In macOS, a positive value specifies clockwise rotation and a negative value specifies counterclockwise rotation.
A new affine transformation matrix.
This function creates a
CGAffine structure, which you can use (and reuse, if you want) to rotate a coordinate system. The matrix takes the following form:
The actual direction of rotation is dependent on the coordinate system orientation of the target platform, which is different in iOS and macOS. Because the third column is always
CGAffine data structure returned by this function contains values for only the first two columns.
These are the resulting equations used to apply the rotation to a point (x, y):
If you want only to rotate an object to be drawn, it is not necessary to construct an affine transform to do so. The most direct way to rotate your drawing is by calling the function