File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
LXReorderableCollectionViewFlowLayout Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 2020
2121@protocol LXReorderableCollectionViewDataSource <UICollectionViewDataSource>
2222
23- - (void )collectionView : (UICollectionView *)collectionView itemAtIndexPath : (NSIndexPath *)fromIndexPath willMoveToIndexPath : (NSIndexPath *)toIndexPath ;
24-
2523@optional
2624
25+ - (void )collectionView : (UICollectionView *)collectionView itemAtIndexPath : (NSIndexPath *)fromIndexPath willMoveToIndexPath : (NSIndexPath *)toIndexPath ;
2726- (BOOL )collectionView : (UICollectionView *)collectionView canMoveItemAtIndexPath : (NSIndexPath *)indexPath ;
2827- (BOOL )collectionView : (UICollectionView *)collectionView itemAtIndexPath : (NSIndexPath *)fromIndexPath canMoveToIndexPath : (NSIndexPath *)toIndexPath ;
2928
Original file line number Diff line number Diff line change @@ -154,8 +154,10 @@ - (void)invalidateLayoutIfNecessary {
154154
155155 self.selectedItemIndexPath = newIndexPath;
156156
157- [self .dataSource collectionView: self .collectionView itemAtIndexPath: previousIndexPath willMoveToIndexPath: newIndexPath];
158-
157+ if ([self .dataSource respondsToSelector: @selector (collectionView:itemAtIndexPath:willMoveToIndexPath: )]) {
158+ [self .dataSource collectionView: self .collectionView itemAtIndexPath: previousIndexPath willMoveToIndexPath: newIndexPath];
159+ }
160+
159161 __weak typeof (self) weakSelf = self;
160162 [self .collectionView performBatchUpdates: ^{
161163 __strong typeof (self) strongSelf = weakSelf;
You can’t perform that action at this time.
0 commit comments