After a long but all in vain search, I am unable to detect the double tap / touch event in my tableview , actually want to call the detail view on double tap on any TableViewCell
and in reality I don't even know how to do it at all .
This is my code so far…
In viewDidLoad
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
tapGesture.numberOfTapsRequired = 2;
[self.myTable addGestureRecognizer:tapGesture];
the handleTapGesture method is
- (void)handleTapGesture:(UITapGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateRecognized) {
flag = true;
}
}
and finally on touching or tapping the cell of tableview the delegate method is
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (flag == true)
{
DetailInvoicing *detail = [[DetailInvoicing alloc] initWithNibName:@"DetailInvoicing" bundle:nil];
detail.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
detail.customerName = [customerArray objectAtIndex:indexPath.row];
[self presentViewController:detail animated:YES completion:nil];
}
}
If I remove this flag condition new view is called on just single touch. where am I wrong or is there any other way to do it .