I have a UIScrollview, inside this scrollview I have a container UIView that contains an UIImageView (scaleToAspect). I use the scrollview to zoom/pan the container-UIView. It works. The user should also be able to rotate the image, i do this by performing an CGAffineTransform on the ImageView. When transforming the ImageView the bounds are not updated so if starting out in Portrait the image fills up aspect correct to the width with margins on bottom and top. After translation to landscape i get the exact same margins on the sides instead (where there should be no margins” so the image dont fill the full width. How to manage this correctly?
The solution was to make bounds of ImageView equal to the frame of the container-UIView that is a direct child to the ScrollView.
imageView.bounds = imageView.superview!.frame