0

So for the app I'm working on I am handling a UILongPressGesture. While that is being done I need to also be able to tap the phone and handle the UITapGesture. I implemented this but it didn't work. If the UILongPressGesture isn't in progress it will call the UITapGesture but not at the same time. So how would I call them at the same time?

-(void)didMoveToView:(SKView *)view {
    m_tapRecognize = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
    m_tapRecognize.cancelsTouchesInView = NO;

    m_pressRecognize = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handlePress:)];
    m_pressRecognize.minimumPressDuration = 1.1f;
    m_pressRecognize.cancelsTouchesInView = NO;

    [view addGestureRecognizer:m_pressRecognize];
    [view addGestureRecognizer:m_tapRecognize];
    [view setMultipleTouchEnabled:true];
}

-(void)handleTap:(UITapGestureRecognizer *)tapGesture {
    NSLog(@"Tap");
}

-(void)handlePress:(UILongPressGestureRecognizer *)pressGesture {
    if (pressGesture.state != UIGestureRecognizerStateEnded)
        NSLog(@"Long Press");
}
CMilby
  • 624
  • 1
  • 6
  • 23

0 Answers0