Permalink
Browse files

Fixes a minor issue where, when moving a cell, and releasing it, it o…

…ccasionally fell to the back of the view hierarchy, making it erratically disappear behind other cells in another GMGridView
  • Loading branch information...
1 parent 1d9ad9d commit 8fbbf2b0bb635a47fc2eb62913a593d070f5b3f2 Timothy Arnold committed May 16, 2012
Showing with 8 additions and 8 deletions.
  1. +8 −8 GMGridView/GMGridView.m
@@ -740,14 +740,8 @@ - (void)sortingMoveDidStopAtPoint:(CGPoint)point
_sortMovingItem.tag = _sortFuturePosition + kTagOffset;
- CGRect frameInScroll = [self.mainSuperView convertRect:_sortMovingItem.frame toView:self];
-
- [_sortMovingItem removeFromSuperview];
- _sortMovingItem.frame = frameInScroll;
- [self addSubview:_sortMovingItem];
-
CGPoint newOrigin = [self.layoutStrategy originForItemAtPosition:_sortFuturePosition];
- CGRect newFrame = CGRectMake(newOrigin.x, newOrigin.y, _itemSize.width, _itemSize.height);
+ CGRect newFrame = [self convertRect:CGRectMake(newOrigin.x, newOrigin.y, _itemSize.width, _itemSize.height) toView:[self mainSuperView]];
[UIView animateWithDuration:kDefaultAnimationDuration
delay:0
@@ -757,6 +751,13 @@ - (void)sortingMoveDidStopAtPoint:(CGPoint)point
_sortMovingItem.frame = newFrame;
}
completion:^(BOOL finished){
+
+ CGRect frameInScroll = [self.mainSuperView convertRect:_sortMovingItem.frame toView:self];
+
+ [_sortMovingItem removeFromSuperview];
+ _sortMovingItem.frame = frameInScroll;
+ [self addSubview:_sortMovingItem];
+
if ([self.sortingDelegate respondsToSelector:@selector(GMGridView:didEndMovingCell:)])
{
[self.sortingDelegate GMGridView:self didEndMovingCell:_sortMovingItem];
@@ -769,7 +770,6 @@ - (void)sortingMoveDidStopAtPoint:(CGPoint)point
}
];
}
-
- (void)sortingMoveDidContinueToPoint:(CGPoint)point
{
int position = [self.layoutStrategy itemPositionFromLocation:point];

0 comments on commit 8fbbf2b

Please sign in to comment.