I have an issue with applying multiple transformations while a maintaining a UIImageView's contentMode.
I have defined an UIImageView with contentMode = UIViewContentModeTop
. My intention is that applying a scale transformation shouldn't skew the image, but keep the top of the image visible.
Unfortunately, setting the transform, still skews the image:
_imageView.transform = CGAffineTransformMakeScale(1.0, 0.5);
As I understand it, this should scale the image to half the height, effectively clipping the bottom part of the image, however as mentioned, the UIImageView seems to use UIViewContentModeScaleToFill
and thereby skewing the image.
The reason I use transform and not just frame manipulations is that I also want to apply a rotation to the view.
It might be relevant that I have also set a custom anchorPoint on the layer:
_imageView.layer.anchorPoint = (CGPoint){0.2, 0.06};