示例
1. 文本属性设置
2. 创建 CTFramesetter
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attributedString);3. 计算文本大小
4. 创建 CTFrame
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, NULL, CGRectMake(0, 0, width, height));
CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, [attributedString length]), path, NULL);5. 绘制文本
6. 处理换行和对齐
7. 事件处理
总结
Last updated