小编ico*_*dev的帖子

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;}`
Run Code Online (Sandbox Code Playgroud)

打破触摸.谢谢.

objective-c uitableview ios

4
推荐指数
1
解决办法
5674
查看次数

标签 统计

ios ×1

objective-c ×1

uitableview ×1