gpt4 book ai didi

ios - 围绕任意点旋转 UIImageView

转载 作者:行者123 更新时间:2023-12-01 17:21:42 26 4
gpt4 key购买 nike

我有一个围绕其中心旋转的 UIImageView:

imageHorizon.layer.anchorPoint = CGPointMake(0.5, 0.5);
imageHorizon.transform = CGAffineTransformRotate(imageHorizon.transform, angleToRotate*(CGFloat)(M_PI/180));

有时我也会将此图像向左或向右移动,然后再次旋转。我想始终将旋转中心保持在同一点(实际上是 super View 的中心)。我怎样才能做到这一点 ?

干杯,

最佳答案

self.imgView.layer.anchorPoint = CGPointMake(0.0,1.0);
self.imgView.layer.position = CGPointMake(100,200.0);
CGAffineTransform cgaRotateHr = CGAffineTransformMakeRotation(-(3.141/4));
[self.imgView setTransform:cgaRotateHr];

关于ios - 围绕任意点旋转 UIImageView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6869336/

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