UILabel本身无法在文本中绘制具有不同属性/字体的标签.但核心文本可以.您可以创建UILabel包装属性字符串的子类,并使用Core Text绘制它.您可以像Core Text编程指南中的示例代码一样处理绘图:
// Build up your attributed string, then...
CTLineRef line = CTLineCreateWithAttributedString(attrString);
// Set text position and draw the line into the graphics context
CGContextSetTextPosition(context, 10.0, 10.0);
CTLineDraw(line, context);
CFRelease(line);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4042 次 |
| 最近记录: |