Game Development Reference
In-Depth Information
to the GameScene init() method right before you add the simpleLabel to the
scene:
simpleLabel.verticalAlignmentMode
= SKLabelVerticalAlignmentMode.Center
Once you have made this change, run the application again. You will now see that the text
has shifted down so that the vertical center of the text is at the simpleLabel 's origin, as
shown in Figure 7-5 .
Figure 7-5 . The simple SKLabelNode example with its verticalAlignmentMode set to SKLabelVerticalAlign-
mentMode.Center
The next vertical alignment option is the value SKLabelVerticalAlign-
mentMode.Top . This value is used to position the text so that the top of the text is on
the node's origin. To see how the value changes the text layout, set simpleLabel 's
Search WWH ::




Custom Search