ScrollView缩放不考虑ImageView的变换

时间:2019-04-12 22:12:46

标签: swift uiscrollview

如果旋转放置在UIImageView内的UIScrollView,并且放大该UIImageView,则旋转不受尊重,并且图像被重置为identity

lazy var imageView: UIImageView = {
    let view = UIImageView(image: self.image)
    view.translatesAutoresizingMaskIntoConstraints = false
    view.contentMode = .scaleAspectFill

    return view
}()

self.imageView.transform = CGAffineTransform(rotationAngle: .pi / 2)

func viewForZooming(in scrollView: UIScrollView) -> UIView? {
    return self.imageView
}

上面的viewForZooming委托似乎将UIImageView返回其身份(在本例中为纵向)。

在尊重设置方向的同时如何允许缩放?

0 个答案:

没有答案