“Pinch to Zoom” using AutoLayout

2019-04-12 00:06发布

问题:

I have followed many "Pinch to Zoom" tutorials I found online, and have done reading on AutoLayout, but I can't get it to work in my project.

My whole project uses AutoLayout, so I don't want to turn it off. I am loading a huge UIImage (EG: 5000px on long edge) into a UIImageView, and i'd like to be able to pinch to zoom and move around the zoomed in image.

I've tried using UIImageView inside a UISrollView, but I couldn't get it to work properly. The closest I could get was some random "glitching" where the image moved erratically when pinched.

Has anybody got 'Pinch to Zoom' to work using Autolayout in iOS 6? I don't care if it uses UIScrollView or something else, I'd just love to get it to work.

Thanks,

Isaac