gpt4 book ai didi

ios - CATextLayer 旋转?

转载 作者:可可西里 更新时间:2023-11-01 06:23:43 26 4
gpt4 key购买 nike

这应该真的有效,但不是:

CATextLayer* textLayer = [CATextLayer layer];
textLayer.string = @"text";
[textLayer setValue:[NSNumber numberWithDouble:M_PI / 2.f forKey:@"transform.rotation"];
[self addSublayer:textLayer];

事实上,当我打印 transform.rotation 的值时,它显示了正确答案。它只是不绘制旋转的 textLayer!

NSLog(@"rotation %@", [textLayer valueForKey:@"transform.rotation"]);

我做错了什么?

最佳答案

试试下面的代码:

textLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMakeRotation(M_PI_2));

代替:

[textLayer setValue:[NSNumber numberWithDouble:M_PI / 2.f forKey:@"transform.rotation"];

关于ios - CATextLayer 旋转?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9269462/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com