layoutAttributesForInteractivelyMovingItem(at:withTargetPosition:)
Retrieves the layout attributes of an item when it is being moved interactively by the user.
Declaration
func layoutAttributesForInteractivelyMovingItem(at indexPath: IndexPath, withTargetPosition position: CGPoint) -> UICollectionViewLayoutAttributesParameters
- indexPath:
The index path of the item being moved.
- position:
The current position of the item in the collection view’s coordinate system.
Return Value
The layout attributes of the item while it is at the specified position.
Discussion
When an item is moving because of user interactivity, the layout object uses this method to retrieve layout attributes to use for the item while it is at the specified position. The default implementation of this method returns a copy of the item’s existing attributes with two changes: the center point is set to the value in position and the zIndex value is set to NSIntegerMax so that the item floats above other items in the collection view.
Subclasses can override this method and modify additional layout attributes as needed. If you override this method, call super first to retrieve the item’s existing attributes and then make your changes to the returned structure.