I'm quite new to ios development and I'm trying to write text on an image and rotate the text
I wrote the text but I'm trying to rotate it around its center
the idea is to translate the text to put its origin on the center then rotate then retranslate to the original position
Here's my code :
context = UIGraphicsGetCurrentContext();
txt = @"Hello";
[[UIColor redColor] set];
CGSize sz = [txt sizeWithFont:font];
rect= CGRectMake(tpoint.x,tpoint.y,sz.width, sz.height);
CGContextTranslateCTM(context, sz.width/2, sz.height/2);
CGContextRotateCTM(context, 0.3);
CGContextTranslateCTM(context, -sz.width/2, -sz.height/2);
[txt drawAtPoint:tpoint withFont:font];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
imageView.image = newImage;