Centre a SKLabelNode on a SKSpriteNode

后端 未结 3 1154
半阙折子戏
半阙折子戏 2021-02-19 20:18

I have an SKLabelNode that is the child of a SKSpriteNode because I\'m trying to create a Button class to create buttons in an easier way. I\'ve tried a couple of things using t

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-19 20:45

    This will put your label in center of scene in sprite kit:

    yourLabel.horizontalAlignmentMode = .Center;
    yourLabel.verticalAlignmentMode = .Center
    

提交回复
热议问题