Q:

iOS how to know if a row is tapped second time in UITableView?

I'm developing an iOS 5 app, in my case if user tap a row from UITableView first time then it will perform some action and if it is tapped second time then it will perform different action.
Now, the problem is that how to know if s particular row is tapped second time?
Thanks in advance!!

A:

Then why don't you use UIGestures with the TableView.This will be the easiest solution which worked for me like charm.
Here is the code which will help you to implement it in your code : 
    // Put this code in your ViewDidLoad:
    UITapGestureRecognizer *doublegesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTableViewCellDoubleTapping:)];
    doublegesture.numberOfTapsRequired = 2;
    [roomTableView addGestureRecognizer:doublegesture];
    [doublegesture release];

//Method to handle the event on double tapping
-(void)didTableViewCellDoubleTapping:(UITapGestureRecognizer *)gestureRecognizer 
{
    if (gestureRecognizer.state == UIGestureRecognizerStateEnded) {
        CGPoint swipeLocation = [gestureRecognizer locationInView:roomTableView];
        NSIndexPath *swipedIndexPath = [roomTableView indexPathForRowAtPoint:swipeLocation];
        NSLog(@"%d",swipedIndexPath.row);
                
        // ... Here you can add your logic
    }
}

In the similar way, if you add another UIGesture for Single tapping
 UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTableViewSingleCellTapping:)];
    gesture.numberOfTapsRequired = 1;
    [roomTableView addGestureRecognizer:gesture];
    [gesture release];
    
    [gesture requireGestureRecognizerToFail:doublegesture];

-(void)didTableViewSingleCellTapping:(UITapGestureRecognizer *)gestureRecognizer 
{
    if (gestureRecognizer.state == UIGestureRecognizerStateEnded) {
        CGPoint swipeLocation = [gestureRecognizer locationInView:roomTableView];
        NSIndexPath *swipedIndexPath = [roomTableView indexPathForRowAtPoint:swipeLocation];
        
        NSLog(@"%d",swipedIndexPath.row);
    }
}

A:

Here is my solution(as Eiko suggest):
Maintain a mutable array and store row index whenever a row is first time selected in array and call first action. When row is selected second time or another row is get selected check if index of that row is present in array, if it is than call second action else add index of row to array and call first action.

