From dc7f1f2606b05dc813be70fc56fad5f524638160 Mon Sep 17 00:00:00 2001 From: Sohayb Hassoun Date: Tue, 23 Feb 2016 14:09:04 +0200 Subject: [PATCH] Added prefix to library's protocol functions, applied change to sample --- .../LXCollectionViewController.m | 14 +++++++------- .../LXReorderableCollectionViewFlowLayout.h | 16 ++++++++-------- .../LXReorderableCollectionViewFlowLayout.m | 14 +++++++------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/LXRCVFL Example using Storyboard/LXRCVFL Example using Storyboard/LXCollectionViewController.m b/LXRCVFL Example using Storyboard/LXRCVFL Example using Storyboard/LXCollectionViewController.m index 33290c9..ff81af7 100644 --- a/LXRCVFL Example using Storyboard/LXRCVFL Example using Storyboard/LXCollectionViewController.m +++ b/LXRCVFL Example using Storyboard/LXRCVFL Example using Storyboard/LXCollectionViewController.m @@ -80,14 +80,14 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell #pragma mark - LXReorderableCollectionViewDataSource methods -- (void)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath willMoveToIndexPath:(NSIndexPath *)toIndexPath { +- (void)lcx_collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath willMoveToIndexPath:(NSIndexPath *)toIndexPath { PlayingCard *playingCard = self.deck[fromIndexPath.item]; [self.deck removeObjectAtIndex:fromIndexPath.item]; [self.deck insertObject:playingCard atIndex:toIndexPath.item]; } -- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath { +- (BOOL)lcx_collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath { #if LX_LIMITED_MOVEMENT == 1 PlayingCard *playingCard = self.deck[indexPath.item]; @@ -105,7 +105,7 @@ - (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath #endif } -- (BOOL)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath canMoveToIndexPath:(NSIndexPath *)toIndexPath { +- (BOOL)lcx_collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath canMoveToIndexPath:(NSIndexPath *)toIndexPath { #if LX_LIMITED_MOVEMENT == 1 PlayingCard *fromPlayingCard = self.deck[fromIndexPath.item]; PlayingCard *toPlayingCard = self.deck[toIndexPath.item]; @@ -126,19 +126,19 @@ - (BOOL)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSInd #pragma mark - LXReorderableCollectionViewDelegateFlowLayout methods -- (void)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout willBeginDraggingItemAtIndexPath:(NSIndexPath *)indexPath { +- (void)lcx_collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout willBeginDraggingItemAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"will begin drag"); } -- (void)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout didBeginDraggingItemAtIndexPath:(NSIndexPath *)indexPath { +- (void)lcx_collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout didBeginDraggingItemAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"did begin drag"); } -- (void)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout willEndDraggingItemAtIndexPath:(NSIndexPath *)indexPath { +- (void)lcx_collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout willEndDraggingItemAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"will end drag"); } -- (void)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout didEndDraggingItemAtIndexPath:(NSIndexPath *)indexPath { +- (void)lcx_collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout didEndDraggingItemAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"did end drag"); } diff --git a/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.h b/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.h index 76617f4..842bc3d 100755 --- a/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.h +++ b/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.h @@ -22,20 +22,20 @@ @optional -- (void)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath willMoveToIndexPath:(NSIndexPath *)toIndexPath; -- (void)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath didMoveToIndexPath:(NSIndexPath *)toIndexPath; +- (void)lcx_collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath willMoveToIndexPath:(NSIndexPath *)toIndexPath; +- (void)lcx_collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath didMoveToIndexPath:(NSIndexPath *)toIndexPath; -- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath; -- (BOOL)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath canMoveToIndexPath:(NSIndexPath *)toIndexPath; +- (BOOL)lcx_collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath; +- (BOOL)lcx_collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath canMoveToIndexPath:(NSIndexPath *)toIndexPath; @end @protocol LXReorderableCollectionViewDelegateFlowLayout @optional -- (void)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout willBeginDraggingItemAtIndexPath:(NSIndexPath *)indexPath; -- (void)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout didBeginDraggingItemAtIndexPath:(NSIndexPath *)indexPath; -- (void)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout willEndDraggingItemAtIndexPath:(NSIndexPath *)indexPath; -- (void)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout didEndDraggingItemAtIndexPath:(NSIndexPath *)indexPath; +- (void)lcx_collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout willBeginDraggingItemAtIndexPath:(NSIndexPath *)indexPath; +- (void)lcx_collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout didBeginDraggingItemAtIndexPath:(NSIndexPath *)indexPath; +- (void)lcx_collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout willEndDraggingItemAtIndexPath:(NSIndexPath *)indexPath; +- (void)lcx_collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout didEndDraggingItemAtIndexPath:(NSIndexPath *)indexPath; @end \ No newline at end of file diff --git a/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m b/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m index 9688aad..09da567 100755 --- a/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m +++ b/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m @@ -178,14 +178,14 @@ - (void)invalidateLayoutIfNecessary { } if ([self.dataSource respondsToSelector:@selector(collectionView:itemAtIndexPath:canMoveToIndexPath:)] && - ![self.dataSource collectionView:self.collectionView itemAtIndexPath:previousIndexPath canMoveToIndexPath:newIndexPath]) { + ![self.dataSource lcx_collectionView:self.collectionView itemAtIndexPath:previousIndexPath canMoveToIndexPath:newIndexPath]) { return; } self.selectedItemIndexPath = newIndexPath; if ([self.dataSource respondsToSelector:@selector(collectionView:itemAtIndexPath:willMoveToIndexPath:)]) { - [self.dataSource collectionView:self.collectionView itemAtIndexPath:previousIndexPath willMoveToIndexPath:newIndexPath]; + [self.dataSource lcx_collectionView:self.collectionView itemAtIndexPath:previousIndexPath willMoveToIndexPath:newIndexPath]; } __weak typeof(self) weakSelf = self; @@ -198,7 +198,7 @@ - (void)invalidateLayoutIfNecessary { } completion:^(BOOL finished) { __strong typeof(self) strongSelf = weakSelf; if ([strongSelf.dataSource respondsToSelector:@selector(collectionView:itemAtIndexPath:didMoveToIndexPath:)]) { - [strongSelf.dataSource collectionView:strongSelf.collectionView itemAtIndexPath:previousIndexPath didMoveToIndexPath:newIndexPath]; + [strongSelf.dataSource lcx_collectionView:strongSelf.collectionView itemAtIndexPath:previousIndexPath didMoveToIndexPath:newIndexPath]; } }]; } @@ -308,7 +308,7 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer self.selectedItemIndexPath = currentIndexPath; if ([self.delegate respondsToSelector:@selector(collectionView:layout:willBeginDraggingItemAtIndexPath:)]) { - [self.delegate collectionView:self.collectionView layout:self willBeginDraggingItemAtIndexPath:self.selectedItemIndexPath]; + [self.delegate lcx_collectionView:self.collectionView layout:self willBeginDraggingItemAtIndexPath:self.selectedItemIndexPath]; } UICollectionViewCell *collectionViewCell = [self.collectionView cellForItemAtIndexPath:self.selectedItemIndexPath]; @@ -350,7 +350,7 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer [highlightedImageView removeFromSuperview]; if ([strongSelf.delegate respondsToSelector:@selector(collectionView:layout:didBeginDraggingItemAtIndexPath:)]) { - [strongSelf.delegate collectionView:strongSelf.collectionView layout:strongSelf didBeginDraggingItemAtIndexPath:strongSelf.selectedItemIndexPath]; + [strongSelf.delegate lcx_collectionView:strongSelf.collectionView layout:strongSelf didBeginDraggingItemAtIndexPath:strongSelf.selectedItemIndexPath]; } } }]; @@ -363,7 +363,7 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer if (currentIndexPath) { if ([self.delegate respondsToSelector:@selector(collectionView:layout:willEndDraggingItemAtIndexPath:)]) { - [self.delegate collectionView:self.collectionView layout:self willEndDraggingItemAtIndexPath:currentIndexPath]; + [self.delegate lcx_collectionView:self.collectionView layout:self willEndDraggingItemAtIndexPath:currentIndexPath]; } self.selectedItemIndexPath = nil; @@ -396,7 +396,7 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer [strongSelf invalidateLayout]; if ([strongSelf.delegate respondsToSelector:@selector(collectionView:layout:didEndDraggingItemAtIndexPath:)]) { - [strongSelf.delegate collectionView:strongSelf.collectionView layout:strongSelf didEndDraggingItemAtIndexPath:currentIndexPath]; + [strongSelf.delegate lcx_collectionView:strongSelf.collectionView layout:strongSelf didEndDraggingItemAtIndexPath:currentIndexPath]; } } }];