因此对于我正在处理的应用程序,我正在处理UILongPressGesture。在完成这项工作的同时,我还需要能够轻触手机并处理UITapGesture。我实现了这个,但它没有用。如果UILongPressGesture没有进行,它将调用UITapGesture但不能同时调用。那我怎么会同时打电话给他们呢?
-(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");
}