Permalink
Browse files

- Keep code convention consistent.

  • Loading branch information...
1 parent 1ee8232 commit 3e0558f901f9478af84d5920739dc0794fd530fd @lxcid committed Dec 26, 2012
Showing with 9 additions and 7 deletions.
  1. +9 −7 LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m
@@ -73,16 +73,18 @@ - (void)invalidateLayoutIfNecessary {
id<LXReorderableCollectionViewDelegateFlowLayout> theDelegate = (id<LXReorderableCollectionViewDelegateFlowLayout>) self.collectionView.delegate;
- if([theDelegate conformsToProtocol:@protocol(LXReorderableCollectionViewDelegateFlowLayout)]){
+ if ([theDelegate conformsToProtocol:@protocol(LXReorderableCollectionViewDelegateFlowLayout)]) {
// Check with the delegate to see if this move is even allowed.
- if([theDelegate respondsToSelector:@selector(collectionView:layout:itemAtIndexPath:shouldMoveToIndexPath:)]){
+ if ([theDelegate respondsToSelector:@selector(collectionView:layout:itemAtIndexPath:shouldMoveToIndexPath:)]) {
BOOL shouldMove = [theDelegate collectionView:self.collectionView
layout:self
itemAtIndexPath:thePreviousSelectedIndexPath
shouldMoveToIndexPath:theIndexPathOfSelectedItem];
- if(!shouldMove) return;
+ if (!shouldMove) {
+ return;
+ }
}
// Proceed with the move
@@ -91,8 +93,7 @@ - (void)invalidateLayoutIfNecessary {
itemAtIndexPath:thePreviousSelectedIndexPath
willMoveToIndexPath:theIndexPathOfSelectedItem];
}
-
-
+
[self.collectionView performBatchUpdates:^{
//[self.collectionView moveItemAtIndexPath:thePreviousSelectedIndexPath toIndexPath:theIndexPathOfSelectedItem];
[self.collectionView deleteItemsAtIndexPaths:@[ thePreviousSelectedIndexPath ]];
@@ -164,12 +165,13 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)theLongPressGestu
CGPoint theLocationInCollectionView = [theLongPressGestureRecognizer locationInView:self.collectionView];
NSIndexPath *theIndexPathOfSelectedItem = [self.collectionView indexPathForItemAtPoint:theLocationInCollectionView];
-
if ([self.collectionView.delegate conformsToProtocol:@protocol(LXReorderableCollectionViewDelegateFlowLayout)]) {
id<LXReorderableCollectionViewDelegateFlowLayout> theDelegate = (id<LXReorderableCollectionViewDelegateFlowLayout>)self.collectionView.delegate;
if ([theDelegate respondsToSelector:@selector(collectionView:layout:shouldBeginReorderingAtIndexPath:)]) {
BOOL shouldStartReorder = [theDelegate collectionView:self.collectionView layout:self shouldBeginReorderingAtIndexPath:theIndexPathOfSelectedItem];
- if(!shouldStartReorder) return;
+ if (!shouldStartReorder) {
+ return;
+ }
}
if ([theDelegate respondsToSelector:@selector(collectionView:layout:willBeginReorderingAtIndexPath:)]) {

0 comments on commit 3e0558f

Please sign in to comment.