1

我正在尝试在我的 CPView 中绘制一些文本,我有这个:

- (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);
}

但是,我在控制台中收到了这个错误: ReferenceError: Can't find variable: CGContextShowTextAtPoint

我该怎么做?

4

1 回答 1

2

CGContextShowTextAtPoint是 CoreText 的一部分,在 Cappuccino 的主分支中尚不可用。你可以看看实验coretext分支。

目前,在 master 中,需要使用常规CPTextField标签绘制文本。

于 2012-01-18T14:20:08.813 回答