简体   繁体   English

iOS拖放图像

[英]iOS drag and drop images

I was trying show a bunch of images, one at once. 我正在尝试显示一堆图像,一次显示一个。 User could swipe left or right to navigate, just like photo library. 用户可以向左或向右滑动来浏览,就像照片库一样。

What I did is, for example I have 6 images, create a scroll view to hold those 6 images, and using pan gesture to move it. 我所做的是,例如,我有6张图像,创建一个滚动视图来保存这6张图像,然后使用平移手势移动它。

Am I doing right? 我做对了吗? Or is there another neat solution? 还是有另一个巧妙的解决方案?

Thanks 谢谢

EDIT: 编辑:

I'm asking am I doing right by using gesture? 我问我使用手势正确吗? More specific, should I use UIScrollView to do this or I should use something else? 更具体地说,我应该使用UIScrollView还是应该使用其他东西?

Update: 更新:

I finally figure out a way to do. 我终于想出一种方法。 Use UIPanGestureRecognizer and check the speed. 使用UIPanGestureRecognizer并检查速度。 if the speed is fast enough, then treat like swipe gesture. 如果速度足够快,请像滑动手势一样对待。 Will post code later. 稍后将发布代码。

UIScrollView具有默认手势,不需要新手势。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM