5

I have a UITableView where my cells handle all the touches instead of the tableview itself. The cells need to respond to both single and double taps instantaneously. (And yes, that does mean the single tap is called then the double tap afterwards, I want them both called).

The single tap action is to drop in another cell below the tapped cell (the cell is a menu for the above cell). I use insertRowsAtIndexPaths for this. However during that animation user interaction seems to fail completely, so I can't pick up on the second tap to fire off that action.

Using 2 UITapGestureRecognizers (a single and double tap) and setting the single to wait for the double to fail works, but causes noticeable delays in the single tap action.

I know during UIView animations you can flag it UIViewAnimationOptionAllowUserInteraction and it will work fine, however that's not an option in UITableView.

Any thoughts of how I can continue to pick up touch events during the tablview animations?

I've tried using UITapGestureRecognizers, using touchesEnded and touchesBegan, none have registered touches during animations.

bclymer
  • 6,679
  • 2
  • 27
  • 36
  • You can't really avoid the noticeable delay for the single tap when using two `UITapGestureRecognizer`s, because it waits a certain period of time for the second touch before deciding it hasn't happened. It's not psychic. – Greg Mar 28 '13 at 12:48
  • http://stackoverflow.com/a/6587505/834998 – Greg Mar 28 '13 at 12:50

1 Answers1

1

Just create your own for loop for performing animation. I used my own recursion logic which looks like animation 0.3 seconds.

NSInteger i = 0;

-(void)recursiveMethod
{
    //Doing Animation task very slowly...
    //For example, Transforming UIView.

    [aView setTransform: CGAffineTransformMakeScale(i/100.0,i/100.0)];

    if(i<100)
    {
        [self performSelector:@selector(recursiveMethod) afterDelay:0.3/100.0];
        i++;
    }
}

And you will be able to perform Touch Action also. Your user interaction will not be desabled by compiler.

Mohd Iftekhar Qurashi
  • 2,385
  • 3
  • 32
  • 44