reloadData调用第二个函数

时间:2011-09-24 17:02:31

标签: iphone xcode sdk

当我调用重载数据时,第二次传递相同的directGestire函数。 如何更正tableView?

 -(void)directGesture:(UISwipeGestureRecognizer *)gesture{
     if (gesture.state == UIGestureRecognizerStateEnded) {
       NSLog(@"Get gesture");  
     [self.tableView beginUpdates];
     [[self displayedObjects] removeObjectAtIndex:2];
     [self.tableView endUpdates]; 
     //have a problem second pass
     [self.tableView reloadData];
     } 
  }

1 个答案:

答案 0 :(得分:0)

    - (void)directGesture:(UISwipeGestureRecognizer *)gesture{

    if (gesture.enabled) {
    //code here 
    }
    //блокировка гестуры
   // NSLog(@"gesture.enabled 1 = %@\n", (gesture.enabled ? @"YES" : @"NO"));
    gesture.enabled = NO;
   // NSLog(@"gesture.enabled   2 = %@\n", (gesture.enabled ? @"YES" : @"NO"));
    //[gesture setDirection:UISwipeGestureRecognizerDirectionUp] ;
    [self.tableView reloadData];
    gesture.enabled = YES;
    //NSLog(@"gesture.enabled 3 = %@\n", (gesture.enabled ? @"YES" : @"NO"));
  }