SceneKitDemo
SceneKitDemo copied to clipboard
property 'textSize' for SCNText ?
SceneKitDemo-master/SCNText/ViewController.m:158:56: error: property 'textSize' not found on object of type 'SCNText *' self.textNode.position = SCNVector3Make(-sceneText.textSize.width / 2 * textScale, -sceneText.textSize.height / 2 * textScale, 0);
Try to get the required property of sceneText following way
SCNVector3 min = SCNVector3Zero;
SCNVector3 max = SCNVector3Zero;
[sceneText getBoundingBoxMin:&min max:&max];
CGFloat textHeight = max.y - min.y;
CGFloat textWidth = max.x - min.x;
self.textNode.position = SCNVector3Make(-textWidth / 2 * textScale, -textHeight / 2 * textScale, 0);
The textSize property is only available on macOS 10.8+. By this, I mean that if you are building a MacOS app then the variable will be accessible, whereas if you are building for IOS it is not.
If you want to get the size of your SCNText you can use it's boundingBox property to get its width and height etc.