UILongPressGestureRecognizer on UITableViewCell - double call

前端 未结 2 1296
情歌与酒
情歌与酒 2020-12-10 19:47

I\'m using the UILongPressGestureRecognizer in a cell. What I need is: when a user taps a cell for 1.0 seconds, call one view controller. If the user taps the cell, another

2条回答
  •  青春惊慌失措
    2020-12-10 20:34

    You have to check state as below

    -  (void)memberListWithSearchOptions:(UILongPressGestureRecognizer*)sender {
    if (sender.state == UIGestureRecognizerStateEnded) {
        NSLog(@"UIGestureRecognizerStateEnded");
        //Do Whatever You want on End of Gesture
    }
    else if (sender.state == UIGestureRecognizerStateBegan){
        NSLog(@"UIGestureRecognizerStateBegan.");
        //Do Whatever You want on Began of Gesture
    }
    

提交回复
热议问题