问题
The anyTouchEndedThisFrame
must be buggy I´ve tried about everything now, and it will only reckonize a touch that´s ended if I move the finger, if I touch and let go at the same spot it does not reckonize it, If I am wrong please correct me
-(void) moveObjectToNewPosition:(KKInput *)input
{
if (input.anyTouchEndedThisFrame) {
[self touchesEnded:[input locationOfAnyTouchInPhase:KKTouchPhaseAny]];
} if (input.anyTouchBeganThisFrame) {
[self touchesBegan:[input locationOfAnyTouchInPhase:KKTouchPhaseBegan]];
}
回答1:
it has never worked even to me, you should implement this method which is very simple to use
-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSSet *allTouches = [event allTouches];
UITouch * touch = [[allTouches allObjects] objectAtIndex:0];
CGPoint location = [touch locationInView: [touch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
}
-(void) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
}
-(void) ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
}
and add into your init this:
[self setTouchEnabled:YES];
来源:https://stackoverflow.com/questions/16519219/kobold2d-kkinput-anytouchendedthisframe