Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在iOS 7中旋转CALayer会随机转换层_Ios_Rotation_Calayer - Fatal编程技术网

在iOS 7中旋转CALayer会随机转换层

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

我试图以给定的角度旋转图像层,但它在iOS 7中表现出一种非常奇怪的行为。它在iOS 8中的工作原理与预期一样,我不知道自己做错了什么

这是预期的图像(iOS 8结果)。(旋转45度)

这是我从iOS 7中得到的

箭头应该与图像具有相同的中心,但它会移动到意外的位置

这是我的密码。(初始平移和定位点是调整旋转中心,因为箭头图像的旋转不应发生在该图像的实际中心周围——即使没有这些线,在iOS 7中也没有任何区别)

谢谢

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];