SKLabelNode包含(q,y,p,g或j)时更高

时间:2016-02-19 20:21:14

标签: swift sprite-kit sklabelnode

例如,我有两个SKLabelNode:" Easy"和"中等"

我将它们设置在相同的高度,但因为容易包含' y,因为他的尾巴它更高

如何将它们放在同一高度?

1 个答案:

答案 0 :(得分:2)

您只需设置它们即可拥有相同的position.y

let easy = SKLabelNode(fontNamed:"Chalkduster")
easy.text = "Easy"
easy.fontSize = 45
easy.position = CGPoint(x:CGRectGetMidX(self.frame) - 200, y:CGRectGetMidY(self.frame))
self.addChild(easy)

let medium = SKLabelNode(fontNamed:"Chalkduster")
medium.text = "Medium"
medium.fontSize = 45
medium.position = CGPoint(x:CGRectGetMidX(self.frame) + 200, y:CGRectGetMidY(self.frame))
self.addChild(medium)

enter image description here