SKLabelNode类

一个SKLabelNode是一个绘制字符串的节点。

要使用标签节点,首先通过调用labelNodeWithFontNamed:方法创建一个新的标签节点。然后配置标签的其他属性,尤其是text属性。

节点的大小由节点的fontName属性,fontSize属性,和text属性共同的隐蔽的决定。默认情况下,文字相对于节点的原点水平居中,字体的基线穿过原点。verticalAlignmentMode属性和horizontalAlignmentMode属性可以调整标签相对于原点的位置。


An SKLabelNode is a node that draws a string.

Just about every game needs to display text at some point, even if it is just to display “Game Over” to the player. If you had to implement this yourself in OpenGL, it would take a fair amount of work to get it correct. But the SKLabelNode class does all of the work necessary to load fonts and create text for display.

To use a label node, create a new label node by calling the labelNodeWithFontNamed: class method. Then configure the other label properties, especially the text property. The size of a label node is determined implicitly by the label node’s fontName, fontSize, and text properties.

By default, the text label is centered horizontally on the label node’s origin, with the font’s baseline passing through the origin. The verticalAlignmentMode and horizontalAlignmentMode properties can be used to adjust the label’s position relative to the origin.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值