发布于 2018-08-21 15:13:46
textSize属性只能在macOS 10.8+上使用,这就是为什么您看不到它(当然,假设您是为IOS构建的)。我的意思是,如果您正在构建一个MacOS应用程序,那么这个变量是可以访问的。然而,如果您正在为IOS构建,则不是。
如果您想获得SCNText的大小,可以使用它的boundingBox属性来获取其宽度和高度,例如:
//1. Get The Bounding Box Of The Text Node
let boundingBox = textNode.boundingBox
//2. Get The Width & Height Of Our Node
let width = boundingBox.max.x - boundingBox.min.x
let height = boundingBox.max.y - boundingBox.min.y如果您只想设置fontSize,可以这样做:
//1. Create An SCNNode With An SCNText Geometry
let textNode = SCNNode()
let textGeometry = SCNText(string: "StackOverflow", extrusionDepth: 1)
textGeometry.font = UIFont(name: "Skia-Regular_Black", size: 20)当然,请记住,当您在ARKit中指定字体大小时,以米为单位。
希望能帮上忙..。
https://stackoverflow.com/questions/51951345
复制相似问题