So, I have a very good panning implementation in a tableview cell. I mainly use panGestureRecognizer and move the cell off-screen and show a different view below the ViewCell table. This is working fine. When I click on tableViewCell, I basically expand the 5 buttons at the bottom.
My goal is to animate 5 buttons while moving the table. For instance,
| 1 | 2 | 3 | 4 | 5 |
If I scroll and move the cell to the right, and I cross with button 1, I will close the button that appears and becomes visible to the user. If I cross 2, then 2 will animate, exiting and becoming visible to the user. And when I am in button 5, all buttons are already inserted and ready for user actions.
I do it with
//Scale Animation CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform"]; scaleAnim.duration = 0.3; scaleAnim.toValue = [NSValue valueWithCATransform3D:CATransform3DIdentity]; scaleAnim.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1,0.1, 1.0)]; scaleAnim.removedOnCompletion = YES; [view.layer addAnimation:scaleAnim forKey:nil];
**
My goal:
**
So, when I am in the middle of the pan gestures, and I decided to close it (move to the left), the buttons should appear and become inaccessible to the user.
In addition, when I move the cell, the button should gradually increase and become available to the user. Therefore, I essentially need to convey the origin of the cell and use the math to calculate the scale for the buttons based on the start and width of the button (pretty straightforward).
if (CGRectIntersectsRect(button.frame, self.movingCell.frame)) { CGFloat xScale = cellTranslation - xOriginForButton; [self popOutAnimate:button withScale:xScale/ (xWidthForButtons + xSpaceBetweenButtons)]; }
But the problem arises when I move the cell very quickly, the views do not get all the changes in the movement of the cells, and they get stuck in a semi-animated state.
I have a feeling that I do not understand the law of logic. The entire implementation is similar to the Sparrow iphone mail application. When you click on a cell, the buttons are displayed with animation when you move the cell. For those who did not use a sparrow. You can see the panning progress at 1:25 https://www.youtube.com/watch?v=XLX6XV0SbWI&t=1m25s
Is logic correct? Did I miss something?
Any help is greatly appreciated.