UIImageView 捏缩放 swift
本文介绍了UIImageView 捏缩放 swift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望有人可以帮助我.我试图允许用户在 UIImageView 上捏缩放(允许最大和最小级别).但由于某种原因,它不能正常工作.图像放大一点然后反弹回来.谢谢.
I was hoping someone could help me out. I am trying to allow a user to pinch zoom on a UIImageView(with a max and min level allowed). But for some reason the it does not work right. The image zooms a little then just bounces back. Thank you.
这是缩放功能
推荐答案
我决定将 imageView 添加到 UIScrollView.它允许用户缩放和平移.这是我使用的代码.
I decided to add the imageView to a UIScrollView. It allows the user to zoom and pan over. Here is the code I used.
为了设置我使用的最大/最小缩放:
in order to set max/min zoom I used :
这里是其余的代码.
我也必须添加这个
斯威夫特 3 &以上函数原型
这篇关于UIImageView 捏缩放 swift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!