Hi Guys,
I'm following an example supplied by Apple here:
https://developer.apple.com/library...tual/drawingwithquartz2d/dq_text/dq_text.html
to draw rotated text to the screen.
I call this function:
with this code from within my CGRect function:
The text prints properly at 45 degrees from the point, but it also causes all
other Quartz 2d drawn text on the screen to become rotated as well.
It also messes up all other graphics including lines and polygons.
I should state that everything is fine until a frame occurs where rotated text is printed.
Probably something simple, as I'm new to Obj-C, and writing as much as possible in C.
How can I fix this?
Cheers, Art.
I'm following an example supplied by Apple here:
https://developer.apple.com/library...tual/drawingwithquartz2d/dq_text/dq_text.html
to draw rotated text to the screen.
I call this function:
Code:
void MyDrawText (CGContextRef myContext, CGRect contextRect) // 1
{
float w, h;
w = contextRect.size.width;
h = contextRect.size.height;
CGAffineTransform myTextTransform;
CGContextSelectFont (myContext,
"Helvetica-Bold",
8,
kCGEncodingMacRoman);
CGContextSetRGBFillColor (myContext, 0, 1, 0, .5);
myTextTransform = CGAffineTransformMakeRotation (45 * 57.29578);
CGContextSetTextMatrix (myContext, myTextTransform);
CGContextShowTextAtPoint (myContext, screenx, screeny, linelabel, 15);
}
with this code from within my CGRect function:
Code:
CGContextRef theContext = UIGraphicsGetCurrentContext();
CGRect viewBounds = self.bounds;
CGContextTranslateCTM(theContext, 0, viewBounds.size.height);
CGContextScaleCTM(theContext, 1, -1);
MyDrawText(theContext, viewBounds);
The text prints properly at 45 degrees from the point, but it also causes all
other Quartz 2d drawn text on the screen to become rotated as well.
It also messes up all other graphics including lines and polygons.
I should state that everything is fine until a frame occurs where rotated text is printed.
Probably something simple, as I'm new to Obj-C, and writing as much as possible in C.
How can I fix this?
Cheers, Art.