CATextLayer 渲染速度 快鱼 UILabel所以以后争取用 CATextLayer 代替UILabel的代替 争取成熟后造轮子!
记录
-(NSDictionary *)attributes{
if (!_attributes) {
CTTextAlignment textAlignment = kCTTextAlignmentCenter;
CTParagraphStyleSetting alignmentStyleSetting;
alignmentStyleSetting.spec = kCTParagraphStyleSpecifierAlignment;
alignmentStyleSetting.valueSize = sizeof(textAlignment);
alignmentStyleSetting.value = &textAlignment;
CTParagraphStyleSetting settings[] = {
alignmentStyleSetting
};
CTParagraphStyleRef style = CTParagraphStyleCreate(settings, 1);
CTFontRef font = CTFontCreateWithName((CFStringRef)WZ6.fontName, 14, NULL);
_attributes = [NSDictionary dictionaryWithObjectsAndKeys:
(__bridge id)font, kCTFontAttributeName,
(id)style, kCTParagraphStyleAttributeName, nil];
}
return _attributes;
}