我很难理解如何以不同的大小、颜色定义 catextlayer 的某些部分以及如何添加换行符?
我需要像这样格式化一页文本:
标题(尺寸 20 HelveticaNeue-Light,黑色)
/n 换行符
第 1 段(尺寸 15 HelveticaNeue-Light,黑色)
/n 换行符
第 2 段(尺寸 15 HelveticaNeue-Light,自定义颜色)
目前我只有标题文字,有人可以帮我吗?
CATextLayer *TextLayer = [CATextLayer layer];
TextLayer.bounds = CGRectMake(0.0f, 0.0f, 245.0f, 290.0f);
TextLayer.string = @"Title";
CTFontCreateWithName((CFStringRef)@"HelveticaNeue-Light", 0.0, NULL);
TextLayer.backgroundColor = [UIColor blackColor].CGColor;
TextLayer.position = CGPointMake(162.0, 250.0f);
TextLayer.wrapped = YES;
TextLayer.fontSize = 20;
[self.view.layer addSublayer:TextLayer];