add contentScale to CATextLayer.

This commit is contained in:
PonyCui
2017-03-17 17:05:40 +08:00
parent 50f26e3660
commit 9b984024bd

View File

@@ -114,6 +114,7 @@
NSAttributedString *text = self.dynamicTexts[sprite.imageKey];
CGSize size = [text boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:NULL].size;
CATextLayer *textLayer = [CATextLayer layer];
textLayer.contentsScale = [[UIScreen mainScreen] scale];
[textLayer setString:self.dynamicTexts[sprite.imageKey]];
textLayer.frame = CGRectMake(0, 0, size.width, size.height);
[contentLayer addSublayer:textLayer];