Ios UIImageView.layer的转换影响UIScrollView缩放

Ios UIImageView.layer的转换影响UIScrollView缩放,ios,uiscrollview,uiimageview,transform,calayer,Ios,Uiscrollview,Uiimageview,Transform,Calayer,我有一个UIImageView,它位于UIScrollView中。我使用以下代码将图像加载到UIImageView的CALayer中: UIImage *image = [UIImage imageNamed: fileToDisplay]; NSLog(@"If I don't flip image imageScrollView.zoomScale: %f", imageScrollView.zoomScale); [[imageView layer] setContents: (i

我有一个UIImageView,它位于UIScrollView中。我使用以下代码将图像加载到UIImageView的CALayer中:

UIImage *image = [UIImage imageNamed: fileToDisplay];    
NSLog(@"If I don't flip image imageScrollView.zoomScale: %f", imageScrollView.zoomScale);
[[imageView layer] setContents: (id)image.CGImage];
if (flipped)
{
    [[imageView layer] setTransform: CATransform3DMakeRotation(180.0 / 180.0 * M_PI, 0.0, 1.0, 0.0)];
    NSLog(@"If image flipped imageScrollView.zoomScale: %f", imageScrollView.zoomScale);
}
我正在围绕y轴“翻转”图像。意外事件是imageView.layer的转换正在更改imageScrollView.zoomScale,如以下输出所示:

如果不翻转图像imageScrollView.zoomScale:0.465455

如果图像翻转imageScrollView.zoomScale:1.000000

我的问题是,我该如何避免这种情况发生?如果没有办法克服这种行为,我必须做些什么来实现在我没有翻转的图像上执行的图像成帧。换句话说,仅将zoomScale设置为变换之前的值是不起作用的。UIScrollView中还发生了一些变化(不是contentSize或contentOffset)


谢谢你的帮助

因为您使用的是
CATTransferorM3dMake…
方法,所以您正在创建一个新的变换并替换当前变换。您需要使用
CATTransformM3dRotate
将旋转添加到当前变换(用于缩放)


因为您使用的是
CATTransformM3dMake…
方法,所以您正在创建一个新的变换并替换当前的变换。您需要使用
CATTransformM3dRotate
将旋转添加到当前变换(用于缩放)

imageView.layer.transform = CATransform3DRotate(imageView.layer.transform , 180.0 / 180.0 * M_PI, 0.0, 1.0, 0.0);