Game Development Reference
In-Depth Information
alAlignmentMode.Center
, and
SKLabelHorizontalAlign-
mentMode.Right
. To see how this property and these options change the layout of the
label node, add the following line of code immediately after the line where you set the po-
sition of the label node:
simpleLabel.horizontalAlignmentMode
= SKLabelHorizontalAlignmentMode.Left
Now run the app again. This time you will see that the label has been shifted to the right,
as shown in
Figure 7-2
.
Figure 7-2
.
A simple SKLabelNode example with its horizontalAlignmentMode set to SKLabelHorizontalA-
lignmentMode.Right
Setting this alignment to
SKLabelHorizontalAlignmentMode.Left
tells Sprite
Kit to place the left side of the
SKLabelNode
at the origin of the label node.