开发者

Move UIImageView along the x-axis using a UIGestureRecognizer

开发者 https://www.devze.com 2023-01-20 18:17 出处:网络
I have four UIImageViews lined up in a row and I want to be able to move the images from left to right.Is there a way to bound the movement to the x-axis (along the image centers) i.e. moving them onl

I have four UIImageViews lined up in a row and I want to be able to move the images from left to right. Is there a way to bound the movement to the x-axis (along the image centers) i.e. moving them only left and right? Similar to moving the icons around the screens on an iPhone.

I've added a 开发者_如何学PythonUIPanGestureRecognizer to each of the views which allows me to move them around everywhere on the screen.

Any thoughts?


Well, if you don't want movement on the y axis, don't modify the y axis. Just change the x coordindate according to the gesture recognizer's movement. What exactly is the problem?

0

精彩评论

暂无评论...
验证码 换一张
取 消