The question part:
CATextLayer does not offer a vertically centering option (it does
offer a horizontal options). So, I thought I'd get cute and change
the affine transform to translate "y" down a bit. However, nothing
happens when I do this (I printed out the transforms to prove to
myself it had taken.)
Surprisingly, the "scale.y" transform works as expected - the text
height responds to this setting.
So, my question: is this a bug? [If so I'll enter a bug report.]
The answer part:
So, I wanted to explore and see if I could find a way to shift the
text down. I finally found that if I subclassed CATextLayer, and
added one method below, I could achieve my goal:
- (void)drawInContext:(CGContextRef)ctx
{
CGFloat height, fontSize;
height = self.bounds.size.height;
fontSize = self.fontSize;
CGContextSaveGState(ctx);
CGContextTranslateCTM(ctx, 0.0, (fontSize-height)/2.0 - 1.0); //
negative
[super drawInContext:ctx];
CGContextRestoreGState(ctx);
}
Thus, including the above for the archives.
David
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden