设备之间的 SKLabelNode 自定义大小

SKLabelNode custom size between devices

我正在使用 SKLabelNode 来显示通用游戏的分数。字体大小对于 iPhone 来说是完美的,但对于 iPad 自然需要更大一些。我想知道是否有任何方法可以更改 iPad 的字体大小?我在 didMoveToView 中试过这个:(可能是完全错误的,但我唯一能想到的)

    if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
scoreLabel.fontSize = 45 } 

这没有用。有任何想法吗?? 注意:如果这有什么不同的话,我使用的是自定义字体而不是苹果字体。

let scoreLabel = SKLabelNode(fontNamed: "DS Digital")

    scoreLabel.position = CGPoint(x: size.width * 0.07, y: size.height * 0.9)
    scoreLabel.text = "0"
    scoreLabel.fontSize = 15
    addChild(scoreLabel)
    scoreLabel.zPosition = 3

    let waitScore = SKAction.waitForDuration(1.0) //add score every second
    let incrementScore = SKAction.runBlock ({
            ++self.score
    self.scoreLabel.text = "\(self.score)"}) //update score label with score
        self.runAction(SKAction.repeatActionForever(SKAction.sequence([waitScore,incrementScore])))

尝试替换

scoreLabel.fontSize = 15

scoreLabel.fontSize = UIDevice.currentDevice().userInterfaceIdiom == .Pad ? 30 : 15