CTFramesetterCreateFrame возвращает ноль - PullRequest
0 голосов
/ 19 мая 2011

Я пытаюсь создать UIView, который будет действовать как круговой TextView.Я могу сделать это нормально на iOS 4.2+, но на 4.0 и 4.1, приведенный ниже вызов CTFramesetterCreateFrame возвращает ноль.Есть мысли?

- (void)drawRect:(CGRect)rect{
[super drawRect:rect];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetTextMatrix(context, CGAffineTransformIdentity);
CGContextTranslateCTM(context, 0, self.bounds.size.height);
CGContextScaleCTM(context, 1.0, -1.0);

CGMutablePathRef path = CGPathCreateMutable();
CGPathAddEllipseInRect(path, NULL, rect);

CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attrString);
CTFrameRef theFrame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, [attrString length]), path, NULL);
CTFrameDraw(theFrame, context);
CGPathRelease(path);
CFRelease(theFrame);
CFRelease(framesetter);
}

1 Ответ

2 голосов
/ 30 марта 2012

Похоже, это вопрос iOS - на iOS вы можете использовать только прямоугольники в качестве путей.Вы добавляете эллипс.

...