![](/img/trans.png)
[英]Drag a UIImageView/UIView on 1 axis without having view.center jump to touch location (dragging from anywhere on view to move on x-axis)
[英]Move UIImageView along the x-axis using a UIGestureRecognizer
我有四個UIImageViews排成一行,我希望能夠從左向右移動圖像。 有沒有辦法將移動限制在x軸上(沿着圖像中心),即僅左右移動它們? 類似於在iPhone的屏幕上移動圖標。
我向每個視圖添加了一個UIPanGestureRecognizer,使我可以在屏幕上的任何位置移動它們。
有什么想法嗎?
好吧,如果您不想在y軸上移動,請不要修改y軸。 只需根據手勢識別器的移動更改x坐標即可。 到底是什么問題?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.