我有一个CATextlayer的问题。我为CATextlayer设置了包装== YES,并自动为此设置多行。但行间距非常小,看起来很糟糕。 有没有办法为CATextlayer设置行间距?谢谢。CATextlayer设置行距?
3
A
回答
0
您可以参考以下教程:
2
我觉得CATextLayer
仅用于轻量级的使用。您可以将其string
属性设置为NSAttributedString
以更改字体和大小等属性,但会忽略其他属性,包括行高和间距。
为了更好地控制图层中文本的呈现方式,您可以使用常规的CALayer
和NSAttributedString
的绘图方法;例如:
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:YES]];
[self.someAttributedString drawInRect:layer.bounds];
[NSGraphicsContext restoreGraphicsState];
}
相关问题
- 1. 将UITextLayer文本设置为CATextLayer?
- 2. 多行CATextLayer
- 3. 如何设置行距Graphics.DrawString
- 4. CTParagraphStyleSetting + CoreText:设置行距
- 5. Imagemagick设置行间距?
- 6. 设置UILabel行间距
- 7. UILabel默认字距不同于CATextLayer
- 8. 多行CATextLayer截断
- 9. CATextlayer中的行数?
- 10. Emacs设置行间距(行尾)注释
- 11. 用VBA设置页脚的行间距
- 12. 在表行之间设置边距
- 13. 设置边距的行动布局
- 14. CATextLayer fontColor?
- 15. CATextLayer和
- 16. 如何为CATextLayer设置动画的字符串属性
- 17. 边距设置为TextView的
- 18. AndroidPlot设置网格间距
- 19. 设置传呼距离
- 20. 在ImageView上设置边距
- 21. CATextLayer包裹sizeToFit?
- 22. CATextLayer旋转?
- 23. CATextLayer的解析
- 24. AutoLayout和CATextLayer iOS7
- 25. CATextLayer + NSAttributtedString + CTParagraphStyleRef
- 26. Mix CATextLayer和CAScrollLayer
- 27. CATextLayer忽略NSMutableParagraphStyle
- 28. CATextLayer不滚动
- 29. 如何在iphone中使用CATextLayer设置视频中的文本位置?
- 30. 在jQuery中为长距离短距离设置动画位置
这根本不回答问题。问题是关于改变'CATextLayer'的行间距,而不是关于计算特定宽度的高度...... – NSAddict