开发者

Use CGAAffineTransform to rotate a + symbol in the middle?

开发者 https://www.devze.com 2023-03-08 21:39 出处:网络
I want to rotate a + to become an x, but it\'s not rotating via the center of the +. How can i get it to开发者_运维问答 rotate via that point?As you suggest just rotate the label :)

I want to rotate a + to become an x, but it's not rotating via the center of the +. How can i get it to开发者_运维问答 rotate via that point?


As you suggest just rotate the label :)

CGAffineTransform rotare = CGAffineTransformMakeRotation(45*M_PI/180.0f);
[plusLabel setTransform:rotare];

If the label is not rotating around the + center include the QuartzCore and rotate the [plusLabel layer]

CATransform3D rotate3D = CATransform3DMakeRotation(45*M_PI/180.0f, 0, 0, 1);
[[plusLabel layer] setAnchorPoint:CGPointMake(0.4, 0.6)]; // The center of Plus in my case
[[plusLabel layer] setTransform:rotate3D];
0

精彩评论

暂无评论...
验证码 换一张
取 消