How to rotate a Context in an iPhone application

CGContextRotateCTM(context, radians(90));

Code to rotate a context is shown above. Give the context as the 1st parameter and give the degrees to the radians method. radians method is shown below.

static inline double radians (double degrees) {return degrees * M_PI/180;}

(Note: you may need to import math.h to use M_PI constant)

No comments: