在子视图中应用任何“转换”后,放大UIScrollView

时间:2015-04-16 10:20:00

标签: ios objective-c iphone uiscrollview uiimageview

我在UIImageWiew中包含UIScrollView以及其他子视图,我需要旋转整个内容,所以我走这条路:

imageView.transform = CGAffineTransformMakeRotation([self.orientation floatValue]);

好,效果很好。

作为滚动视图中的ImageView,我还需要设置zoomScale以调整内部图像的大小,并且我这样做:

- (void)updateZoom {
    const float minZoom = MIN(self.view.bounds.size.width / self.imageView.image.size.width,
                        self.view.bounds.size.height / self.imageView.image.size.height);
    if (minZoom > 1) {
        return;
    }
    self.scrollView.minimumZoomScale = minZoom;
    self.scrollView.zoomScale = minZoom;
}

updateZoom 会影响"重置"初始转换,使图像回到原始方向。 通常,每次我修改" zoomScale"财产,定位得到恢复。

如何将两个方向都保持为zoomScale?

我想我需要在scrollView委托中执行一些操作:

- (void)scrollViewDidZoom:(UIScrollView *)scrollView;

1 个答案:

答案 0 :(得分:0)

我只是在GitHub上放了一个可以帮助你的回购。它在Swift中,但它应该

PhotoSlideShow-Swift

相关问题