拖动图像并将其保留在 iPhone 上拖动的位置
我有一个地图图像,我希望能够将图像拖动到屏幕上的某个位置,然后能够从网络服务器获取另一个图像,其中新的地图图像位于旧图像被拖动的位置。
我已经在 UIScrollView 中尝试了 UIImageView,但如果我尝试将其拖走,图像会弹回以填充屏幕。设置 UIScrollView .bounces = NO 也不是我所需要的,因为这只会阻止我将图像拖离屏幕。有没有一种简单的方法来获得此功能?
I have a map image and I would like to be able to drag the image somewhere on the screen and then be able to go get another image from a webserver with the new map image being where the old image was dragged.
I've tried the UIImageView in a UIScrollView but the image is bounced back to fill the screen if I try to drag it off. Setting the UIScrollView .bounces = NO isn't what I need either because that just prevents me from dragging the image off of the screen. Is there an easy way to get this functionality?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您想查看
UIResponder
方法touchesBegan
、touchesMoved
和touchesEnded
。I think you want to look at the
UIResponder
methodstouchesBegan
,touchesMoved
andtouchesEnded
.我最终使用 UIPinchGestureRecognizer 和 UIPanGestureRecognizer 来执行此操作。
I ended up using UIPinchGestureRecognizer and UIPanGestureRecognizer to do this.