如果旋转放置在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返回其身份(在本例中为纵向)。
在尊重设置方向的同时如何允许缩放?