我正在使用手势识别器:
初始化viewDidLoad
:
UILongPressGestureRecognizer *longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
[self.view addGestureRecognizer:longPressRecognizer];
这longPress
看起来像:
- (void)longPress:(UILongPressGestureRecognizer*)gestureRecognizer {
if (gestureRecognizer.minimumPressDuration == 2.0) {
NSLog(@"Pressed for 2 seconds!");
}
}
我怎么能把它绑起来?
- (void)tableView:(UITableView *)tblView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
didSelectRowAtIndexPath 将如何获得对 的引用gestureRecognizer.minimumPressDuration
?
基本上我想要实现的是:
**If a user clicks on a cell, check to see if the press is 2 seconds.**