ios - Sprite kit double tap detection -



ios - Sprite kit double tap detection -

i'm using spritekit game, observe single tap , double tap using next code:

-(void)touchesended:(nsset *)touches withevent:(uievent *)event { uitouch* touch = [touches anyobject]; if (touch.tapcount == 1){ [self.tapqueue addobject:@1]; nslog(@"touch.tapcount == 1 :)"); } if (touch.tapcount == 2) { [self.tapqueue addobject:@2]; nslog(@"touch.tapcount == 2 :)"); } } -(void)processusertapsforupdate:(nstimeinterval)currenttime { (nsnumber* tapcount in [self.tapqueue copy]) { if ([tapcount unsignedintegervalue] == 1) [self singletap]; if ([tapcount unsignedintegervalue] == 2) [self doubletap]; [self.tapqueue removeobject:tapcount]; } }

this code observe single tap when observe double tap observe single tap it. how can difference between single tap , double tap?

thanks

are saying single tap reported twice during double tap, 1 time single tap , 1 time double tap, before double tap reported?

also seek answering question, create global tapcount instead of relying on tapcount touch events. or boolean var tappedonce check create sure double tapped.

ios iphone touch sprite-kit

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -