CATextLayer字体模糊问题
把其中的几个字变深色一点或者变颜色,代码如下:NSMutableAttributedString *attriString = [[[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"Promotion", nil)]
autorelease];
[attriString addAttribute:(NSString *)kCTForegroundColorAttributeName value:(id)[UIColor colorWithRed:255 green:200 blue:0 alpha:1].CGColor range:NSMakeRange(0,124)];
[attriString addAttribute:(NSString *)kCTForegroundColorAttributeName
value:(id)[UIColor redColor].CGColor
range:NSMakeRange(124, 6)];
[attriString addAttribute:(NSString *)kCTForegroundColorAttributeName value:(id)[UIColor colorWithRed:255 green:200 blue:0 alpha:1].CGColor range:NSMakeRange(130,10)];
CATextLayer *textLayer = [CATextLayer layer];
textLayer.string = attriString;
textLayer.fontSize=15;
textLayer.frame = CGRectMake(0, 20, 280, 160);
textLayer.backgroundColor=[[UIColor clearColor]CGColor];
//需要设置CALayer的contentsScale属性。这个值来自于屏幕的backingScaleFactor, contentsScale = 2表示retina屏幕;
textLayer.contentsScale = 2;
[whiteBackground.layer addSublayer:textLayer];