I’m trying to change the image scale in a UIImageView, I want it to be smaller and keep its ratio.
I tried cameraPhoto.image?.scale = CGFloat(0.5)
but it doesn’t work, i get Cannot assign to property: 'scale' is a get-only property
Anyone knows how to get around this?
Thanks
2
Answers
I think you need to create UIImageView with size of your image and place it on UIScrollView (and disable scroll). Then you can change scale of scroll view.
https://www.brightec.co.uk/blog/creating-a-zoomable-image-view-in-swift
You can use from this extensions:
and use this function in your image