长敲击检测后如何开始移动?使用uilongpressgesturerecognizer进行长时间检测。 我的代码:
`- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
flMoveRow = NO;
[self setEditing:YES animated:YES];
[listView reloadData];
}
- (void)longTapGesture:(UILongPressGestureRecognizer *)sender{
if((sender.state != UIGestureRecognizerStateEnded)&&(!flMoveRow)){
NSLog(@"==longTapGesture:");
flMoveRow = YES;
[listView beginUpdates];
NSArray *indexPaths = [[NSArray alloc] initWithObjects:indexPath, nil];
[listView reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
[listView endUpdates];
sender.enabled = NO;
return;
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath{
NSLog(@"==canMoveRowAtIndexPath:%i -- %d", indexPath.row, (int)flMoveRow);
return flMoveRow;}`
打破触摸。感谢。
答案 0 :(得分:19)
cocoacontrols.com上有一个模拟Clear应用程序的控件。它仍然在显着地工作,但是当我下载它时,它仍然非常令人印象深刻。您可以将其完全合并到您的应用中,也可以将其作为您自己研究的起点。