UICollectionView reordering cell keep custom cell height

Pete092Pete092 GBUniversity ✭✭

Hi Experts,

I have followed Xamarin's UICollection view example: http://developer.xamarin.com/guides/ios/platform_features/introduction_to_ios9/uicollectionview/

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:http://nshint.io/blog/2015/07/16/uicollectionviews-now-have-easy-reordering/
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?

thanks
Yong

Answers

Sign In or Register to comment.