我能够解决这个由于@InvalidMemory的评论和@ mike663的答案。基本上,您可以按照包含标签的矩形比例缩放标签。
func adjustLabelFontSizeToFitRect(labelNode:SKLabelNode, rect:CGRect) {
// Determine the font scaling factor that should let the label text fit in the given rectangle.
let scalingFactor = min(rect.width/labelNode.frame.width, rect.height/labelNode.frame.height)
// Change the fontSize.
labelNode.fontSize *= scalingFactor
// Optionally move the SKLabelNode to the center of the rectangle.
labelNode.position = CGPoint(x: rect.midX, y: rect.midY - labelNode.frame.height/2.0)
}
这里是链接到other question。
这个类似的问题应该可以帮到你我认为>> http://stackoverflow.com/q/30980918 –