0
我正在使用顯示用戶列表的UITableView。我已經實現委託方法:TableView editingStyleForRowAtIndexPath:沒有用UIPanGestureRecognizer調用?
- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
中向左滑動,該單元格以刪除用戶的記錄,這是工作的罰款,但現在我添加UIPanGestureRecognizer控制器回去通過右鍵重擊在視圖中。現在問題是沒有正確調用tableView委託方法。所以任何幫助/建議將不勝感激如何處理案件。由於
這裏是我的UIPanGestureRecognizer操作:
-(void)performAction:(UIPanGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateChanged){
velocity = [sender velocityInView:self.view];
NSLog(@"Velocity X: %f Y: %f",velocity.x,velocity.y);
}
else if (sender.state == UIGestureRecognizerStateEnded){
BOOL isHorizentalMotion = fabs(velocity.x) > fabs(velocity.y);
BOOL isHorizentallyLeft = velocity.x < 0 ? YES : NO;
BOOL isHorizentallyRight = velocity.x > 0 ? YES : NO;
if (isHorizentalMotion && isHorizentallyRight) {
NSLog(@"RIGHT GESTURE");
[self menuClicked:nil];
}
}
}
UITapGestureRecognizer *自來水= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKeyboard :)]; \t tap.cancelsTouchesInView = NO; [self.view addGestureRecognizer:tap]; – OMGHaveFun