ios - 需要在 icarousel 中拖放 View

标签 ios ipad icarousel

我在我的 iPad 应用程序中使用 icarousel。我想要一个像在 icarousel 中拖放对象的功能。将 View 拖出轮播以从中删除项目,并将 View 拖放到轮播中以将项目添加到其中。我已从 https://github.com/nicklockwood/iCarousel 下载了 icarousel。

我尝试了使用委托(delegate)方法的拖放功能

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

但是整个 View 都困惑了。请帮我一下。 预先感谢您。

最佳答案

这是一篇旧帖子,但以防万一您仍然陷入困境,这就是我们所做的。

拉出 View :

  1. 向 iCarousel 添加平移手势识别器
  2. 在 recognizerStateBegan 上标记触摸点
  3. 在 recognizerStateChanged 上调整 View 的框架或变换
  4. 检查 recognizerStateEnded 上的位置

    4.1 商品未完全退回

    4.2 如果完全退出,则从数据源中删除项目

  5. 重新加载 iCarousel

您可以执行与在 iCarousel 上放置的 View 非常相似的操作,但方向相反。

关于ios - 需要在 icarousel 中拖放 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9883596/

相关文章:

ios - Swift:启用 UICollectionView 分页

iphone - 我的 ImageView 在 TableView 中表现不正常?

ios - iCarousel - numberOfItemsInCarousel : unrecognized selector sent to instance

javascript - 地理位置不适用于 iOS 和 Meteor

ios - 我该怎么办 ITMS-90683 : Missing Purpose String in Info. plist

ios - Paypal MECL iOS - 显示 "Pay with a Card"直接查看

iphone - 如何在启用分页的情况下在 UIScrollView 中延迟加载 100 多个页面?

iphone - iOS:通过电子邮件、短信或 Facebook 邀请好友

iphone - 从 iCarousel 生成的 subview 调用 segue

ios - iCarousel 配置任务