I use gesture recognizers:
Initialize to viewDidLoad:
UILongPressGestureRecognizer *longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
[self.view addGestureRecognizer:longPressRecognizer];
Here is what it looks like longPress:
- (void)longPress:(UILongPressGestureRecognizer*)gestureRecognizer {
if (gestureRecognizer.minimumPressDuration == 2.0) {
NSLog(@"Pressed for 2 seconds!");
}
}
How can I tie this up?
- (void)tableView:(UITableView *)tblView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
How will helpSelectRowAtIndexPath get a link to gestureRecognizer.minimumPressDuration?
I am mainly trying to achieve:
**If a user clicks on a cell, check to see if the press is 2 seconds.**
source
share