SceneKit – NSAttributedString 未显示为 SCNText
SceneKit – NSAttributedString is not shown as SCNText
为什么这些代码行有效:
let text = NSString(string: "Test")
(node.geometry as! SCNText).string = text
但这些不是:
let text = NSAttributedString(string: "Test")
(node.geometry as! SCNText).string = text
使用属性文本时,SCNText
根本不会显示。有什么想法吗?
谢谢。
我自己发现的。问题是相对于场景尺寸的字体大小。在我的例子中,标准字体太小了。
解决了!
为什么这些代码行有效:
let text = NSString(string: "Test")
(node.geometry as! SCNText).string = text
但这些不是:
let text = NSAttributedString(string: "Test")
(node.geometry as! SCNText).string = text
使用属性文本时,SCNText
根本不会显示。有什么想法吗?
谢谢。
我自己发现的。问题是相对于场景尺寸的字体大小。在我的例子中,标准字体太小了。
解决了!