iOS Tap gesture state begin doesn't hit

前端 未结 5 1058
半阙折子戏
半阙折子戏 2021-01-12 13:56

I have made a view clickable with a tap gesture recognizer, which is working just fine. But I want to highlight the view when the touch happens en remove it when the touch e

5条回答
  •  借酒劲吻你
    2021-01-12 14:34

    It might be too late. But this will also help you, if you strictly want to use Gesture recognizer.

       UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]
                                             initWithTarget:self 
                                             action:@selector(refresh:)];
        longPress.minimumPressDuration = 0.0;
    
     - (IBAction)refresh:(UILongPressGestureRecognizer *)sender {
         if(self.currentStatus == NODATA){
           if(sender.state == UIGestureRecognizerStateBegan){
             NSLog(@"Began!");
             [self.dashboardViewController.calendarContainer state:UIViewContainerStatusSELECTED];
           }
           if (sender.state == UIGestureRecognizerStateEnded){
             NSLog(@"%@", @"Ended");
            [self.dashboardViewController.calendarContainer state:UIViewContainerStatusNORMAL];
           } 
           [self setState:REFRESHING data:nil];
        }
       }
    

提交回复
热议问题