在iOS 7中旋转CALayer会随机转换层
我试图以给定的角度旋转图像层,但它在iOS 7中表现出一种非常奇怪的行为。它在iOS 8中的工作原理与预期一样,我不知道自己做错了什么 这是预期的图像(iOS 8结果)。(旋转45度) 这是我从iOS 7中得到的 箭头应该与图像具有相同的中心,但它会移动到意外的位置 这是我的密码。(初始平移和定位点是调整旋转中心,因为箭头图像的旋转不应发生在该图像的实际中心周围——即使没有这些线,在iOS 7中也没有任何区别) 谢谢在iOS 7中旋转CALayer会随机转换层,ios,rotation,calayer,Ios,Rotation,Calayer,我试图以给定的角度旋转图像层,但它在iOS 7中表现出一种非常奇怪的行为。它在iOS 8中的工作原理与预期一样,我不知道自己做错了什么 这是预期的图像(iOS 8结果)。(旋转45度) 这是我从iOS 7中得到的 箭头应该与图像具有相同的中心,但它会移动到意外的位置 这是我的密码。(初始平移和定位点是调整旋转中心,因为箭头图像的旋转不应发生在该图像的实际中心周围——即使没有这些线,在iOS 7中也没有任何区别) 谢谢 if (CATransform3DIsIdentity(self.comp
if (CATransform3DIsIdentity(self.compassImageView.layer.transform)) {
self.compassImageView.layer.transform = CATransform3DTranslate(CATransform3DIdentity, 0, 5, 0);
}
self.compassImageView.layer.anchorPoint = CGPointMake(0.5, 95 / 180.0);
NSString *zRotationKeyPath = @"transform.rotation.z";
[self.compassImageView.layer setValue:@(targetAngle * M_PI / 180.0) forKeyPath:zRotationKeyPath];