Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView reorder like Clear app

How to start moving after the long tap detect? long tap detect with uilongpressgesturerecognizer. My code:

`- (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;}`

break touch. Thanks.

like image 385
icocoadev Avatar asked Dec 01 '22 00:12

icocoadev


1 Answers

There is a control available on cocoacontrols.com which mimics the Clear app. It is still being worked on apparently but when I downloaded it, it was still very impressive. You could either incorporate it fully in your app or use it as a starting point in your own research.

link.

like image 64
Damo Avatar answered Dec 03 '22 12:12

Damo