0
我試圖創建一個UIView,它將充當一個圓形的TextView。我可以在iOS 4.2+上做到這一點,但在4.0 & 4.1上,CTFramesetterCreateFrame下面的調用返回nil。有什麼想法嗎?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);
}