在iOS上使用一些CoreText代码,我不明白为什么这是CTFrame的过度使用。我已经确认这是一个过度释放,但我感到困惑,因为它是创建一个
create
for (NSValue *value in [self frameArray]) {
CGRect column = [value CGRectValue];
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, NULL, column);
CTFrameRef frame = CTFramesetterCreateFrame(bodyFramesetter, CFRangeMake(position, 0), path, NULL);
CTFrameDraw(frame, context);
position += CTFrameGetVisibleStringRange(frame).length;
CGPathRelease(path);
// ???: Why does this cause an overrelease?
//CFRelease(frame);
}
更新
代码基础是3.2,崩溃不会发生在第一个版本上。它在绘制视图时“随机”出现在某个点上。这个循环,你可能猜到了
-drawRect:
看风景。此应用程序中没有多线程。