UITableView重新排序,如清除应用程序

时间:2012-03-01 12:54:25

标签: objective-c ios uitableview

长敲击检测后如何开始移动?使用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;}`

打破触摸。感谢。

1 个答案:

答案 0 :(得分:19)

cocoacontrols.com上有一个模拟Clear应用程序的控件。它仍然在显着地工作,但是当我下载它时,它仍然非常令人印象深刻。您可以将其完全合并到您的应用中,也可以将其作为您自己研究的起点。

link

相关问题