UIImageView 手势(缩放、旋转)问题
问题描述
我想对 UIImageView
进行 2 次缩放、旋转操作,我有 2 个问题:
I would like to make 2 operations to an UIImageView
zoom, rotate, I have 2 problems:
A. 我为 ex 做了一个缩放操作.当我尝试进行旋转 UIImageView
设置为初始大小时,我想知道如何保持缩放后的 UIImageView
并从缩放后的图像进行旋转.
A. I make an operation for zoom for ex. and when I try to make rotation the
UIImageView
is set to initial size, I would like to know how to keep the zoomedUIImageView
and make the rotation from the zoomed image.
B.我想将缩放操作与旋转结合起来,但我不知道如何实现:
B. I would like to combine the zoom operation with rotation and I don't know ho to implement this:
谢谢
推荐答案
希望对你有所帮助,这就是我通常实现手势识别器的方式:
Hope this can be helpful to you, that's how I usually implement gesture recognizers:
Rotate 方法:应用后将手势识别器的旋转重置为 0,因此下一个回调是当前旋转的增量
Rotate method: Reset the gesture recognizer's rotation to 0 after applying so the next callback is a delta from the current rotation
Scale 方法,最后在应用后将手势识别器的比例重置为 1,因此下一个回调是当前比例的增量
Scale Method, at the end reset the gesture recognizer's scale to 1 after applying so the next callback is a delta from the current scale
确保特定视图上的捏合、平移和旋转手势识别器都可以同时识别,以防止其他手势识别器同时识别
Than ensure that the pinch, pan and rotate gesture recognizers on a particular view can all recognize simultaneously prevent other gesture recognizers from recognizing simultaneously
相对于图层的锚点应用缩放和旋转变换此方法在用户手指之间移动手势识别器视图的锚点
Scale and rotation transforms are applied relative to the layer's anchor point this method moves a gesture recognizer's view's anchor point between the user's fingers
这篇关于UIImageView 手势(缩放、旋转)问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!