【发布时间】:2024-01-11 13:50:01
【问题描述】:
我有以下代码,允许用户通过按下按钮来旋转屏幕上的图像。
self.imageView.transform = CGAffineTransformRotate(self.imageView.transform, rotationAmount);
此图像位于 UIScrollView 内,用户可以通过它放大照片。问题是当用户缩放时,变换被重置。我可以存储变换的值,然后在缩放后重新应用它,但图像看起来好像在旋转版本和非旋转版本之间弹跳。
有没有办法在缩放期间保持变换?
这是滚动视图的代码
self.scrollView.minimumZoomScale=1.0;
self.scrollView.maximumZoomScale=6.0;
self.scrollView.contentSize=CGSizeMake(screenHeight, screenWidth-toolBarHeight);
self.scrollView.delegate=self;
[_scrollView setContentMode:UIViewContentModeScaleAspectFit];
[_scrollView sizeToFit];
[_scrollView setContentSize:CGSizeMake(_imageView.frame.size.width, _imageView.frame.size.height)];
【问题讨论】:
-
你能贴出放大照片的代码吗?
标签: ios objective-c uiscrollview uiimageview rotation