Forum Xamarin.iOS

UICollectionView reordering cell keep custom cell height

Pete092Pete092 GBUniversity ✭✭

Hi Experts,

I have followed Xamarin's UICollection view example:

I used custom layout with variable cell heights (described at the bottom of the article). However, when I move one cell to another, it changes the heights to the target cell.

AFAIK, this example is a port of this post:
At the end of that post, there is a method to keep the collection cell height, I cannot translate swift code to c# version.

internal override func invalidationContextForInteractivelyMovingItems(targetIndexPaths: [NSIndexPath],
    withTargetPosition targetPosition: CGPoint,
    previousIndexPaths: [NSIndexPath],
    previousPosition: CGPoint) -> UICollectionViewLayoutInvalidationContext {

    var context = super.invalidationContextForInteractivelyMovingItems(targetIndexPaths,
        withTargetPosition: targetPosition, previousIndexPaths: previousIndexPaths,
        previousPosition: previousPosition)

    self.delegate?.collectionView!(self.collectionView!, moveItemAtIndexPath: previousIndexPaths[0],
        toIndexPath: targetIndexPaths[0])

    return context

Could anyone help to translate the above swift code into Xamarin c# version please?



Sign In or Register to comment.