用Core Text创建简单杂志应用2.docVIP

  • 1
  • 0
  • 约1.1万字
  • 约 8页
  • 2016-04-14 发布于浙江
  • 举报
用Core Text创建简单杂志应用2

用Core Text创建简单杂志应用 现在,我们已经获得所有的文本块和格式标签(如同前面见到的font标签)。需要做的仅仅是遍历文本块数组然后构建NSAttributedString . 在方法体中加入以下代码: for (NSTextCheckingResult* b in chunks) { NSArray* parts = [[markup substringWithRange:b.range] componentsSeparatedByString:@]; //1 CTFontRef fontRef = CTFontCreateWithName( (CFStringRef)self.font, 24.0f, NULL); //apply the current text style //2 NSDictionary* attrs=[NSDictionary dictionaryWithObjectsAndKeys: (id)self.color.CGColor, kCTForegroundColorAttributeName, (id)fontRef, kCTFontAttributeName,

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档