1
我想縮放長按和拖拉時的collectionview,當用戶端拖動時,單元格應該以常規大小顯示。放大UICollectionViewCell長按並拖動時
我使用下面的步驟創建演示,但工作正常,但放大效果不如預期。 Collection View Example
這裏是動作代碼我使用:
func handleLongGesture(gesture: UILongPressGestureRecognizer) {
switch(gesture.state) {
case UIGestureRecognizerState.Began:
guard let selectedIndexPath = self.collectionView.indexPathForItemAtPoint(gesture.locationInView(self.collectionView)) else {
break
}
collectionView.beginInteractiveMovementForItemAtIndexPath(selectedIndexPath)
case UIGestureRecognizerState.Changed:
collectionView.updateInteractiveMovementTargetPosition(gesture.locationInView(gesture.view!))
case UIGestureRecognizerState.Ended:
collectionView.endInteractiveMovement()
default:
collectionView.cancelInteractiveMovement()
}
}