CATextLayer == UILabel
//create a text layer
CATextLayer *textLayer = [CATextLayer layer];
textLayer.frame = CGRectMake(0, 0, 200, 200);
// textLayer.position = CGPointMake(20, 20);//layer在view的位置 适用于跟随摸一个不固定长的的控件后面需要的
textLayer.foregroundColor = [UIColor blackColor].CGColor;//字体的颜色 文本颜色
textLayer.alignmentMode = kCAAlignmentLeft;//字体的对齐方式
textLayer.wrapped = YES;//默认为No. 当Yes时,字符串自动适应layer的bounds大小
UIFont *font = [UIFont systemFontOfSize:15]; //choose a font
CFStringRef fontName = (__bridge CFStringRef)font.fontName;
CGFontRef fontRef = CGFontCreateWithFontName(fontName);
textLayer.font = fontRef;
textLayer.fontSize = font.pointSize;
textLayer.contentsScale = [UIScreen mainScreen].scale;//文字模糊以Retina方式来渲染,防止画出来的文本像素化
CGFontRelease(fontRef); //与CFRelease的功能相当 当字体的null的时候不会引起程序出错
NSString *text = @"将阿萨德反馈啦圣诞节快乐房间里看撒健康的肌肤垃圾都是";
textLayer.string = text;
[self.layer addSublayer:textLayer];