[英]Trying to move UIImageView on UIPanGestureRecognizer
Hi Guys I am trying to move UIImageView using the following code on UIPanGestureRecognizer 嗨,大家好,我正在尝试使用UIPanGestureRecognizer上的以下代码移动UIImageView
CGPoint pointMove;
pointMove.x = holderView.center.x + (currentPoint.x - lastPoint.x);
pointMove.y = holderView.center.y + (currentPoint.y - lastPoint.y);
holderView.center = pointMove;
lastPoint = currentPoint;
But this is giving a jumble on moving not moving smoothly. 但是,这给移动不顺畅带来了混乱。 Please help me
请帮我
i got a best example of Dragging Image using UIPanGestureRecognizer
我有一个使用
UIPanGestureRecognizer
拖动图像的最佳示例
please download this demo and check it :- 请下载此演示并检查它:-
https://github.com/elc/iCodeBlogDemoPhotoBoard https://github.com/elc/iCodeBlogDemoPhotoBoard
hope it's help's you 希望对你有帮助
here are some same Asked Question please visit link:- 这是一些相同的问题,请访问链接:-
Drag + Rotation using UIPanGestureRecognizer touch getting off track 使用UIPanGestureRecognizer触摸拖动+旋转偏离轨道
swapping images using pan gesture 使用平移手势交换图像
How to use UIPanGestureRecognizer to move object? 如何使用UIPanGestureRecognizer移动对象? iPhone/iPad
iPhone / iPad
Try to change this in your code. 尝试在您的代码中更改它。
CGPoint translation = [gestureRecognizer translationInView:[holderView superview]];
[holderView setCenter:CGPointMake([piece center].x + translation.x, [piece center].y + translation.y)];
I hope this will solve your problem 我希望这能解决您的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.