我正在尝试将文本写入SCNBox节点。我看到框中的文字,但文字方向是肖像。我该如何制作这个风景?
CALayer *layer = [CALayer new];
[layer setFrame:CGRectMake(0, 0, 100, 100)];
[layer setBackgroundColor:[UIColor redColor].CGColor];
CATextLayer *textLayer = [CATextLayer new];
[textLayer setFrame:[layer bounds]];
[textLayer setFontSize:24];
[textLayer setString:@"TEST"];
[textLayer setAlignmentMode:kCAAlignmentLeft];
[textLayer setForegroundColor:[UIColor blackColor].CGColor];
[textLayer display];
[layer addSublayer:textLayer];
SCNBox *box = [SCNBox boxWithWidth:1 height:2 length:0.005 chamferRadius:0.0];
[[[box firstMaterial] diffuse] setContents:layer];
// [[[box firstMaterial] diffuse] setContents:[UIColor redColor]];
[[box firstMaterial] setLightingModelName:SCNLightingModelConstant];
[[box firstMaterial] setDoubleSided:YES];
SCNNode *node = [SCNNode nodeWithGeometry:box];
答案 0 :(得分:0)
您可以像这样旋转textLayer:
CGAffineTransform transform = CGAffineTransformIdentity;
transform = CGAffineTransformRotate(transform, self.angle); // angle in radians
label.transform = transform;