I am trying to draw some text in my CPView, I have this:
- (void)drawRect:(CGRect)aRect{
var ctx = [[CPGraphicsContext currentContext] graphicsPort],
viewBounds = [self bounds];
CGContextTranslateCTM(ctx, 0, viewBounds.size.height);
CGContextScaleCTM(ctx, 1, -1);
CGContextSetLineWidth(ctx, 2.0);
CGContextShowTextAtPoint(ctx, 100.0, 100.0, "SOME TEXT", 9);
}
But, I got this error in the console: ReferenceError: Can't find variable: CGContextShowTextAtPoint
how should I do this?
CGContextShowTextAtPoint
is a part of CoreText which is not yet available in the master branch of Cappuccino. You might take a look at the experimental coretext
branch.
For now, in master, text needs to be drawn using regular CPTextField
labels.