如何解决如何取消将单元格从collectionView拖放的顶部和底部移动?
我有几个单元格,我希望我的单元格只能左右移动。我的代码
// MARK: - Drag and drops for collectionView
extension ExerciseMakeUpViewController {
// MARK: Press Gesture
@objc func handleLongPressGesture(_ gesture: UILongPressGestureRecognizer) {
guard let collectionView = collectionView else { return }
switch gesture.state {
case .began:
guard let targetIndexPath = collectionView.indexPathForItem(at: gesture .location(in: collectionView)) else { return }
collectionView.beginInteractiveMovementForItem(at: targetIndexPath)
case .changed:
collectionView.updateInteractiveMovementTargetPosition(gesture.location(in: collectionView))
case .ended:
collectionView.endInteractiveMovement()
configureNextButton(true)
default:
collectionView.cancelInteractiveMovement()
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。