release when dragging a cell #102

Open
wants to merge 2 commits into
from
@@ -211,6 +211,7 @@ - (void)commonInit
_sortingPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(sortingPanGestureUpdated:)];
_sortingPanGesture.delegate = self;
+ _sortingPanGesture.maximumNumberOfTouches = 1;
[self addGestureRecognizer:_sortingPanGesture];
_longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressGestureUpdated:)];
@@ -740,14 +741,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 +752,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 +771,6 @@ - (void)sortingMoveDidStopAtPoint:(CGPoint)point
}
];
}
-
- (void)sortingMoveDidContinueToPoint:(CGPoint)point
{
int position = [self.layoutStrategy itemPositionFromLocation:point];